简体   繁体   English

ASP,vbscript,CDO通过AWS的电子邮件被截断了吗?

[英]ASP, vbscript, CDO Email through AWS is truncated?

I am moving this classic ASP app to AWS and using AWS SES SMTP to send site emails (automated, post registration email). 我正在将这个经典的ASP应用程序移至AWS,并使用AWS SES SMTP发送站点电子邮件(自动的,注册后的电子邮件)。

So, the code below works but when the email arrives it is truncated (incomplete)? 因此,下面的代码有效,但是当电子邮件到达时,它被截断了(不完整)?

Mail Function: 邮件功能:

 Function Sendmail(Sender, Subject, Recipient, Body) dim myMail, strServer strServer = Request.ServerVariables("server_name") if strServer <> "localhost" then Set myMail=Server.CreateObject("CDO.Message") myMail.Subject=Subject myMail.From=Sender myMail.To=Recipient myMail.HTMLBody=Body myMail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2 'Name or IP of remote SMTP server myMail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="email-smtp.us-east-1.amazonaws.com" 'Server port myMail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=465 'requires authentication myMail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=1 'username myMail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusername")="a username" 'password myMail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendpassword")="a password" 'startTLS myMail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpusessl")=true myMail.Configuration.Fields.Update myMail.Send set myMail=nothing end if End function 

Mail Body 邮件正文

 <!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'><html lang='en'><head> <meta http-equiv='Content-Type' content='text/html; charset=windows-1258'> <meta name='viewport' content='width=device-width, initial-scale=1'> <meta http-equiv='X-UA-Compatible' content='IE=edge'> <meta name='format-detection' content='telephone=no'> <title>Title</title> <link rel='stylesheet' type='text/css' href='http://www.website.com/styles.css'> <link rel='stylesheet' type='text/css' href='http://www.website.com/responsive.css'></head><body style='margin:0; padding:0;' bgcolor='#F0F0F0' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'><table border='0' width='100%' height='100%' cellpadding='0' cellspacing='0' bgcolor='#F0F0F0'><tr><td align='center' valign='top' bgcolor='#F0F0F0' style='background-color: #F0F0F0;'> <br/> <table border='0' width='600' cellpadding='0' cellspacing='0' class='container'><tr><td class='header' align='left'><img src='http://www.website.com/images/email/logo_small_en.png'/> </td></tr><tr> <td class='container-padding content' align='left' bgcolor='#FFFFFF'> <br/><div class='title'>Welcome to the site! </div><br/><div class='body-text'> <p>Welcome to the website<div class='hr'></div><br/><div class='subtitle'>Have fun!</div><br/> </td></tr><tr> <td class='container-padding footer-text' align='left'><br/>&copy; 2016 <br/> <br/>You are receiving this email because you registered for the website. Please click here to <a href=''>unsubscribe</a>. <br/> </td></tr></table></td></tr></table></body></html> 

Truncated always at the same spot? 总是在同一地点被截断?

 <!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'><html lang='en'><head> <meta http-equiv='Content-Type' content='text/html; charset=windows-1258'> <meta name='viewport' content='width=device-width, initial-scale=1'> <meta http-equiv='X-UA-Compatible' content='IE=edge'> <meta name='format-detection' content='telephone=no'> <title>Title</title> <link rel='stylesheet' type='text/css' href='http://www.website.com/styles.css'> <link rel='stylesheet' type='text/css' href='http://www.website.com/responsive.css'></head><body style='margin:0; padding:0;' bgcolor='#F0F0F0' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'><table border='0' width='100%' height='100%' cellpadding='0' cellspacing='0' bgcolor='#F0F0F0'> <tr> <td align='center' valign='top' bgcolor='#F0F0F0' style='background-color: #F0F0F0;'> <br/> <table border='0' width='600' cellpadding='0' cellspacing='0' class='container'> <tr> <td class='he 

I can't seem to track this down? 我似乎无法找到答案? Is the error in my function or the mail body? 是我的函数或邮件正文中的错误? Is it an AWS limitation? 它是AWS的限制吗?

Thanks for your thoughts, 谢谢你的想法

SMTP servers can throw a "Line too long" error when a line of the email exceeds some server-defined length. 当电子邮件行超过某些服务器定义的长度时,SMTP服务器可能会引发“行过长”错误。 Since your message is always truncated at the same spot try inserting line breaks into your message body. 由于您的消息总是在同一位置被截断,因此请尝试在消息正文中插入换行符。 I know AWS SES SMTP can return this error but I am unsure as to what the limit is. 我知道AWS SES SMTP可以返回此错误,但是我不确定该限制是多少。 Here is a related conversation with a similar error and CDO for reference. 这是一个具有类似错误和CDO的相关对话 ,以供参考。

CDO uses 7bit for content transfer encoding by default, which does not truncate the long lines. 默认情况下,CDO使用7bit进行内容传输编码,这不会截断长行。

You don't need a user defined function but specify an appropriate content transfer encoding for the message body. 您不需要用户定义的函数,而是为消息正文指定适当的内容传输编码。

8bit , quoted-printable and base64 are standard transfer encodings will take care of the long lines. 8bitquoted-printablebase64是标准的传输编码,将处理较长的行。

'...
myMail.Configuration.Fields.Update
myMail.HTMLBodyPart.ContentTransferEncoding = "8bit"
myMail.Send
'...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM