GmailをgmailのSMTPサーバーに送信しようとしました。ヘッダーのコンテンツタイプをエンコードする理由:text/html; OutlookプラグインでMailItemを使用すると、GMAILのSMTPサーバーであるSMTP.GMAIL.COMが使用されていますか?
もし私がそのようなコードを書いてHTMLを送っても問題はありません。
MailMessage mail = new MailMessage("[email protected]", to, subject, body);
mail.IsBodyHtml = true;
SmtpClient smtpClient = new SmtpClient(smtp);
smtpClient.EnableSsl = true;
smtpClient.Port = 587;
smtpClient.Credentials = new NetworkCredential(userName, password);
smtpClient.Send(mail);
メールはGmailアカウントで受信ヘッダを持つbase64で である:
Subject: Test
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: base64
PGh0bWw==
(このベース64は、それが唯一の問題のためだ、有効ではありません)
しかし、もし私がOutlook.MailItemを使って私のメールを送信すると、私は何を得るのでしょうか?
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<https://fdsafasdfasd.com/images/logo.png> =09
Cedric Boivin
[email protected]
Vous a envoy=E9 un message s=E9curis=E9 vifdasfasdfes
私のテキストはクリアで、GmailのHTMLでは見えません。 Outlookプラグインに自分のコードがあります
Microsoft.Office.Interop.Outlook.MailItem newMail = Globals.ThisAddIn.Application.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
// newMail.Display(false);
newMail.Subject = subject;
newMail.To = email.ToLower().Trim();
newMail.Recipients.ResolveAll();
newMail.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatHTML;
newMail.HTMLBody = htmlBody;
newMail.Send();
何か提案がありますか?
さて、多分あなたが頼まれた変種でこの答えにリンクし、将来誰かを助けるために縛られました。 –