Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Galera
Eu estou tentando colocar a formatação HTml na hora de eu enviar o email só que está complicado.
Alguém pode me dá um Help?
********************************************************************************
****************
Dim DateNow As String
Dim first As String, Second As String, Third As String
Dim Fourth As String, Fifth As String, Sixth As String
Dim Seventh As String
With Winsock1
Dim se_body As String
Dim se_date As String
Dim se_from As String
Dim se_to As String
Dim se_mime As String
Dim se_content_type As String
Dim se_content_type_message As String
Dim se_content_type_attach As String
Dim x_mailer As String
Dim x_oem As String
se_mime = "MIME-Version: 1.0"
se_content_type = "Content-Type: multipart/related;" & vbCrLf _
& vbTab & "boundary = " & """" & boundary & """"
x_oem = "X-OEM: zubin"
x_mailer = "X-Mailer: " & """" & "HTMLMail" & """" & " - by VTech http://vtech.ifrance.com"
se_content_type_message = "This is a multi-part message in MIME format." & vbCrLf _
& "--" & boundary & vbCrLf _
& "Content-Type: text/html;" & vbCrLf _
& vbTab & "charset=" & """" & "iso-8859-1" & """" & vbCrLf _
& "Content-Transfer-Encoding: 7bit"
se_body = vbCrLf _
& vbCrLf _
& vbCrLf _
& se_date & vbCrLf _
& se_mime & vbCrLf _
& x_oem & vbCrLf _
& x_mailer & vbCrLf _
& se_content_type & vbCrLf _
& vbCrLf _
& se_content_type_message & vbCrLf _
& vbCrLf _
& EmailBodyOfMessage & vbCrLf _
& vbCrLf _
& se_content_type_attach & vbCrLf _
& "." & vbCrLf
If .State = sckClosed Then ' Check to see if socket is closed
DateNow = Format(Date, "Ddd") & ", " & Format(Date, "dd Mmm YYYY") & " " & Format(Time, "hh:mm:ss") & "" & " -0600"
first = "mail from: " & FromEmailAddress & vbCrLf ' Get who's sending E-Mail address
Second = "rcpt to: " & ToEmailAddress & vbCrLf ' Get who mail is going to
Third = "Date: " & DateNow & vbCrLf ' Date when being sent
Fourth = "From: """ & FromName & """ <" & FromEmailAddress & ">" + vbCrLf ' Who's Sending
Fifth = "To: " & ToNametxt & vbCrLf ' Who it going to
Sixth = "Subject: " & EmailSubject & vbCrLf ' Subject of E-Mail
Seventh = se_body & vbCrLf ' E-mail message body
Ninth = "X-Mailer: STMP Sender" & vbCrLf ' What program sent the e-mail, customize this
.LocalPort = 0 ' Must set local port to 0 (Zero) or you can only send 1 e-mail per program start
.Protocol = sckTCPProtocol ' Set protocol for sending
.RemoteHost = MailServerName ' Set the server address
.RemotePort = 25 ' Set the SMTP Port
.Connect ' Start connection
WaitFor ("220")
StatusTxt.Caption = "Connecting...."
.SendData ("HELO EnterComputerNameHere" & vbCrLf)
WaitFor ("250")
StatusTxt.Caption = "Connected"
.SendData (first)
StatusTxt.Caption = "Sending Message"
WaitFor ("250")
.SendData (Second)
WaitFor ("250")
.SendData ("data" & vbCrLf)
WaitFor ("354")
.SendData (Fourth & Third & Ninth & Fifth & Sixth & vbCrLf)
.SendData Seventh & vbCrLf
.SendData (".")
WaitFor ("250")
.SendData ("quit" & vbCrLf)
StatusTxt.Caption = "Disconnecting"
WaitFor ("221")
.Close
Else
MsgBox (str(.State))
End If
End With
********************************************************************************
****************
Grato
Carregando comentários...