I am trying to create a PHP script to send AMP Emails with PHPMailer. When reading online tutorial I found that you can specify Mime types in PHPMailer as follows:
$mail->AltBody = "Hello, my friend! This message uses plain text !";
This should create alternative body in TEXT format and the message will automatically use the MIME type multipart/alternative. However, according to the AMP for Email official documentation, I need to set a completely new MIME type for AMP Emails: text/x-amp-html
. I can’t seem to find a way to do that with PHPMailer. I am building this script so I later can re-create the code on Magento 2. For now I only found this plugin that should do exactly what I need. However, I believe this PHP script that I am trying to build, should be useful for the whole Stackoverflow community.
My last idea was to send AMP Email using native PHP mail() function, but I don’t know how. I think, I must pass AMP Email HTML in $message
variable and set AMP headers in $headers
. Please see below:
mail($to, $subject, $message, $headers);
Any help appreciated!
mail()
. It's perhaps a bit too broad, but I still think it's within the scope of SO. – Goodbye StackExchange