2016-09-17 2 views
1

私はこの古典的なASPアプリケーションをAWSに移行し、AWS SES SMTPを使用してサイトの電子メールを送信します(自動化、登録後の電子メール)。ASP、vbscript、CDO AWS経由のメールは切り捨てられますか?

したがって、以下のコードは動作しますが、メールが届くと、切り詰められます(不完全)。

メール機能:

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

メール本文

<!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>

常に同じ位置で切り捨てられますか?

<!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

私はこれを追跡するように見えることはできませんか?私の機能やメールの本文に誤りがありますか?それはAWSの制限ですか?電子メールの行は、いくつかのサーバーに定義された長さを超えたときに自分の考えのための

おかげで、

答えて

1

SMTPサーバーには、「行が長すぎます」というエラーをスローすることができます。あなたのメッセージは常に同じ場所で切り捨てられるので、メッセージ本文に改行を挿入してみてください。私はAWS SES SMTPがこのerrorを返すことができることを知っていますが、私は限界が何であるか確信しています。参考のために同様のエラーとCDOを持つ関連するconversationがあります。

+0

ありがとうございます!これを試してみよう! – user1964234

+0

ブリリアント!このスレッドのWordWrap関数を使用して、HTML本体に適用しました。作品! http://forums.devarticles.com/asp-development-3/send-email-via-asp-15546.html – user1964234

+0

Woohoo!過去のASP/ADOの爆破に感謝します! – jbird

1

CDOは、デフォルトでコンテンツ転送エンコーディングに7bitを使用します。これは長い行を切り捨てません。

ユーザー定義関数は必要ありませんが、メッセージ本文には適切なコンテンツ転送エンコーディングを指定します。

8bit,およびbase64は、標準の転送エンコードが長い行を処理します。

'... 
myMail.Configuration.Fields.Update 
myMail.HTMLBodyPart.ContentTransferEncoding = "8bit" 
myMail.Send 
'... 
関連する問題