I recently came to know about AMP email and found it interesting and tried an example in nodejs using nodemailer package.
This package already contains an option 'amp' to send AMP specific emails, however I am unable to make it work.
The AMP version of email is really plain and it doesnt contain any xhr requests. Below is my code which sends an email to a specific email address.
let transporter = nodeMailer.createTransport({
host: 'smtp.gmail.com',
port: 465,
secure: true,
auth: {
user: "validuser@gsuiteBusinessdomain.com",
pass: "validpassword"
},
});
let mailOptions = {
from: 'sender@gsuiteBusinessdomain.com', // sender address
to: "enduser@gsuiteBusinessdomain.com", // list of receivers
subject: "test subject", // Subject line
text: " basic text body example ", // plain text body
html: '<b>basic html body example</b>', // html body
amp: `<!--
Below is the mininum valid AMP4EMAIL document. Just type away
here and the AMP Validator will re-check your document on the fly.
-->
<!doctype html>
<html ⚡4email>
<head>
<meta charset="utf-8">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<style amp4email-boilerplate>body{visibility:hidden}</style>
</head>
<body>
Hello, AMP4EMAIL world.
</body>
</html>`
};
transporter.sendMail(mailOptions, (error, info) => {
if (error) {
console.log(error);
}
console.log('Message %s sent: %s', info.messageId, info.response);
});
Also, I tried using "MailKit" package in C# but was not sure how to set an AMP version here. I added my AMP version under message.body section of MimeMessage class.
message.Body = new TextPart(TextFormat.RichText)
{
Text = @"<!-- ........
I am sure there is something really small that I am missing but unable to figure it out. Could someone take a look and guide me whats going wrong with above code?