做自动发邮件的代码一直没什么问题,只是这次要求加上FromName和ToName,稍微费了点力气
其实主要是格式的问题啦~ 果然还是应该加引号的,本来之前试过不加引号也能发出去的,可是今天不知怎么,咋也发送不成功了,错误代码‘8004020e’
于是网上好一顿大海捞针,说是应该以下面酱紫的格式.... = =|||
objMessage.From = """" & FromName & """<" & FromMail & ">"
objMessage.To = """" & ToName& """<" & ToMail & ">" //This would result in "Joe Bloggs"<joe@bloggs.com>
dim
strEmailMessage
' Send email to the lead ***************************************
strEmailMessage = " <html><head></head><body><table border=0 cellpadding=0 cellspacing=0> "
strEmailMessage = strEmailMessage & " <tr><td valign=top>Thank you for contacting us. We have received your request for returned merchandise, and your Return Merchandise Authorization code is <b> " & xxxNumber & " </b>.....</td></tr> "
strEmailMessage = strEmailMessage & " <tr><td>We will also email you a Refund Receipt as soon as we have received and processed your returned merchandise. However, if you have any questions about your refund, please feel free to reply to this email. Or you may call us at " & mid (Phone, 1 , 3 ) & " - " & mid (Phone, 4 , 3 ) & " - " & mid (Phone, 7 , 4 ) & " from 5am to 5pm pacific time.</td></tr> "
strEmailMessage = strEmailMessage & " <tr><xd valign=top> </td></tr> "
strEmailMessage = strEmailMessage & " <tr><td>Sincerely, Customer Service </td></tr> "
strEmailMessage = strEmailMessage & " <tr><td> " & ClientName & " </td></tr> "
strEmailMessage = strEmailMessage & " </table></body></html> "
set objMessage = CreateObject ( " CDO.Message " )
objMessage.Configuration.Fields.Item ( " http://schemas.microsoft.com/cdo/configuration/sendusing " ) = 2 ' Send the message using the network (SMTP over the network).
objMessage.Configuration.Fields.Item ( " http://schemas.microsoft.com/cdo/configuration/smtpserver " ) = " xxx.xxx.xxx.xxx " ' ip
objMessage.Configuration.Fields.Item ( " http://schemas.microsoft.com/cdo/configuration/smtpserverport " ) = 25
objMessage.Configuration.Fields.Item ( " http://schemas.microsoft.com/cdo/configuration/smtpusessl " ) = False ' Use SSL for the connection (True or False)
objMessage.Configuration.Fields.Item ( " http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout " ) = 60
objMessage.Configuration.Fields.Update
objMessage.Subject = " Your Return Merchandise Authorization code "
objMessage.From = """" & FromName & """<" & FromMail & ">"
objMessage.To = """" & ToName& """<" & ToMail & ">"
objMessage.HTMLBody = strEmailMessage
objMessage.Send
set objMessage = nothing
' Send email to the lead ***************************************
strEmailMessage = " <html><head></head><body><table border=0 cellpadding=0 cellspacing=0> "
strEmailMessage = strEmailMessage & " <tr><td valign=top>Thank you for contacting us. We have received your request for returned merchandise, and your Return Merchandise Authorization code is <b> " & xxxNumber & " </b>.....</td></tr> "
strEmailMessage = strEmailMessage & " <tr><td>We will also email you a Refund Receipt as soon as we have received and processed your returned merchandise. However, if you have any questions about your refund, please feel free to reply to this email. Or you may call us at " & mid (Phone, 1 , 3 ) & " - " & mid (Phone, 4 , 3 ) & " - " & mid (Phone, 7 , 4 ) & " from 5am to 5pm pacific time.</td></tr> "
strEmailMessage = strEmailMessage & " <tr><xd valign=top> </td></tr> "
strEmailMessage = strEmailMessage & " <tr><td>Sincerely, Customer Service </td></tr> "
strEmailMessage = strEmailMessage & " <tr><td> " & ClientName & " </td></tr> "
strEmailMessage = strEmailMessage & " </table></body></html> "
set objMessage = CreateObject ( " CDO.Message " )
objMessage.Configuration.Fields.Item ( " http://schemas.microsoft.com/cdo/configuration/sendusing " ) = 2 ' Send the message using the network (SMTP over the network).
objMessage.Configuration.Fields.Item ( " http://schemas.microsoft.com/cdo/configuration/smtpserver " ) = " xxx.xxx.xxx.xxx " ' ip
objMessage.Configuration.Fields.Item ( " http://schemas.microsoft.com/cdo/configuration/smtpserverport " ) = 25
objMessage.Configuration.Fields.Item ( " http://schemas.microsoft.com/cdo/configuration/smtpusessl " ) = False ' Use SSL for the connection (True or False)
objMessage.Configuration.Fields.Item ( " http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout " ) = 60
objMessage.Configuration.Fields.Update
objMessage.Subject = " Your Return Merchandise Authorization code "
objMessage.From = """" & FromName & """<" & FromMail & ">"
objMessage.To = """" & ToName& """<" & ToMail & ">"
objMessage.HTMLBody = strEmailMessage
objMessage.Send
set objMessage = nothing
http://bbs.blueidea.com/thread-2817482-1-1.html
http://newbeeshome.spaces.live.com/blog/cns!4B319CEEA4E3B052!267.entry
http://forums.aspfree.com/asp-development-5/8004020e-error-137062.html