私は電子メールでイベントの予約と処理を送信するためにGoogleのEmail Markupを使用しようとしています。アプリからメールを送信するときにGoogleのスキーマが機能しない
これは、私がこのtutorialに従って開始しており、うまくいきます。
次に、私はVisual StudioでC#で開発したアプリを通じて同じメールを送信しようとしました。電子メールは正常に送信されますが、マークアップはありません。 SPFに関連する問題がないので、私はここで
などGmailのSMTPサーバーを使用して、私のメールアドレスに自分のメールアドレスからメールを送信しています私のコードです:
reservation.html
<html>
<body>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "EventReservation",
"reservationNumber": "IO12345",
"underName": {
"@type": "Person",
"name": "John Smith"
},
"reservationStatus": "booked",
"reservationFor": {
"@type": "Event",
"name": "Google I/O 2013",
"startDate": "2017-09-09T08:30:00-08:00",
"location": {
"@type": "Place",
"name": "Moscone Center",
"address": {
"@type": "PostalAddress",
"streetAddress": "800 Howard St.",
"addressLocality": "San Francisco",
"addressRegion": "CA",
"postalCode": "94103",
"addressCountry": "US"
}
}
}
}
</script>
<p>
Dear John, thanks for booking your Google I/O ticket with us.
</p>
<p>
BOOKING DETAILS<br />
Reservation number: IO12345<br />
Order for: John Smith<br />
Event: Google I/O 2013<br />
Start time: May 15th 2013 8:00am PST<br />
Venue: Moscone Center, 800 Howard St., San Francisco, CA 94103<br />
</p>
</body>
</html>
はStartup.cs
private static void sendemail(IApplicationBuilder app)
{
app.Run(async context =>
{
string message=context.Request.Form["message"];
Newtonsoft.Json.Linq.JObject messageJson = JsonConvert.DeserializeObject<Newtonsoft.Json.Linq.JObject>(message);
Newtonsoft.Json.Linq.JObject messageResult = new Newtonsoft.Json.Linq.JObject();
string email = messageJson["email"].ToString();
string subject = messageJson["subject"].ToString();
MailMessage emailmessage = new MailMessage();
emailmessage.From = new MailAddress(email);
emailmessage.To.Add(new MailAddress("[email protected]"));
emailmessage.Subject = subject;
string email_body = File.ReadAllText("reservation.html");
emailmessage.IsBodyHtml = true;
emailmessage.BodyEncoding = System.Text.Encoding.UTF8;
emailmessage.BodyTransferEncoding =System.Net.Mime.TransferEncoding.QuotedPrintable;
emailmessage.Body = email_body;
SmtpClient client = new SmtpClient();
client.Host=myConfiguration.GetSection("SmtpServer").Value;
client.Port = int.Parse(myConfiguration.GetSection("SmtpPort").Value);
client.Credentials = new NetworkCredential(myConfiguration.GetSection("Username").Value,myConfiguration.GetSection("Password").Value);
client.EnableSsl = true;
client.Send(emailmessage);
messageResult["SmtpServer"] = myConfiguration.GetSection("SmtpServer").Value;
context.Response.ContentType = "application/json";
await context.Response.WriteAsync(messageResult.ToString());
});
}
私の印象では、それがnであるということです私のコードでは、イベントが電子メールに追加されるのを妨げているのですが、むしろgmailがそれをブロックしています。
私は他の投稿を見ましたが、残念ながらそれほど助けにはなりませんでした。
誰もが同じ問題を抱えていて、それを解決できましたか?
完全に。 –