۲۱-اردیبهشت-۱۳۸۹, ۰۵:۰۴:۰۵
سلام:
چه شکلی می شود با دلفی هم مثل VB ایمیل زد.
من در قسمت VB این کد را دیدم که با آن می شد ایمیل زد.
چه شکلی می شود با دلفی هم مثل VB ایمیل زد.
من در قسمت VB این کد را دیدم که با آن می شد ایمیل زد.
کد:
Function SendMail(Sender As String, Subject As String, Reciever As String, Text As String, Password As String, AttachFile As String) As Boolean
If Sender <> "" Or Password <> "" Then
frmMain.MousePointer = 11
Dim iMsg, iConf, Flds, schema, SendEmailGmail
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
' send one copy with Google SMTP server (with autentication)
schema = "http://schemas.microsoft.com/cdo/configuration/"
Flds.Item(schema & "sendusing") = 2
Flds.Item(schema & "smtpserver") = "smtp.gmail.com"
Flds.Item(schema & "smtpserverport") = 25
Flds.Item(schema & "smtpauthenticate") = 1
Flds.Item(schema & "sendusername") = Sender
Flds.Item(schema & "sendpassword") = Password
Flds.Item(schema & "smtpusessl") = 1
Flds.Update
With iMsg
DoEvents
.To = Reciever
.From = Sender
.Subject = Subject
.HTMLBody = Text
.Sender = Sender
.Organization = "S.M.B Productions"
.ReplyTo = Sender
If AttachFile <> "" Then
.AddAttachment (AttachFile)
End If
Set .Configuration = iConf
SendEmailGmail = .Send
End With
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
frmMain.MousePointer = 0
SendMail = True
Else
MsgBox "Please, Fill the Sender Mail Address or Sender Mail Password", vbCritical, "Connection Error"
SendMail = False
End If
End Function