Ich benutze Amazon AWS SES. So sende ich E-Mails:HTML-E-Mails senden als HTML-Code
$request = array();
$request['Source'] = $row['emailfromname'] . " <{$verifyemail[0]}>";
$request['Destination']['ToAddresses'] = $to;
$request['Message']['Subject']['Data'] = $row['emailsubject'];
$request['Message']['Body']['Html']['Data'] = $row['emailbody'];
try {
$result = $client->sendEmail($request);
$messageId = $result->get('MessageId');
...
So ist es ziemlich einfach.
Mein Problem ist, dass einige E-Mails als HTML senden. Hier ist ein Beispiel für einen Täter:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><p><span style="font-family: Calibri, sans-serif; line-height: 11pt; font-size: 11pt; color: #333333;">Hi Name,</span></p>
<hr><span style="font-size:11pt;font-family:'Calibri',sans-serif"><b>From:</b> [email protected]<br><b>Sent:</b> Thursday, 9 March 2017 10:51 AM<br><b>To:</b> [email protected]<br><b>Subject:</b> Enquiry for ID: 98419081886, 123 Fake Street,
Docklands, Vic 3008, Listing Agent Leasing Consultant</span><br><br><div id="message" style="width: 600px; margin: 0 auto;">
<h1 class="header">
<img src="http://www.test.com/logo.png" style="border: 0; width: 258px;"><div class="header-separator" style="height: 4px; background-color: #e4002b; width: 100%; margin-top: 17px;"></div>
</h1>
<p style="margin: 0;">You have received a new enquiry for</p>
<br><p style="margin: 0;"> id: 98419081886</p>
<div class="footer" style="margin-top: 1em; padding: 5px; background: #999999; color: #fff;">
Message sent from <a href="http://www.test.com.au" style="color: #fff;">www.test.com.au</a> </div>
</div></body></html>
Es sendet im Klartext als HTML-Code mit der seltsamen Header-Info. Das ist mein Outlook 2010 E-Mail erhalten:
Docklands, Vic 3008, Listing Agent Leasing Consultant
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><p><span style="font-family: Calibri, sans-serif; line-height: 11pt; font-size: 11pt; color: #333333;">Hi Name,</span></p> <hr><span style="font-size:11pt;font-family:'Calibri',sans-serif"><b>From:</b> [email protected]<br><b>Sent:</b> Thursday, 9 March 2017 10:51 AM<br><b>To:</b> [email protected]<br><b>Subject:</b> Enquiry for ID: 98419081886, 123 Fake Street, Docklands, Vic 3008, Listing Agent Leasing Consultant</span><br><br><div id="message" style="width: 600px; margin: 0 auto;">
<h1 class="header">
<img src="http://www.test.com/logo.png" style="border: 0; width: 258px;"><div class="header-separator" style="height: 4px; background-color: #e4002b; width: 100%; margin-top: 17px;"></div>
</h1>
<p style="margin: 0;">You have received a new enquiry for</p>
<br><p style="margin: 0;"> id: 98419081886</p>
<div class="footer" style="margin-top: 1em; padding: 5px; background: #999999; color: #fff;">
Message sent from <a href="http://www.test.com.au" style="color: #fff;">www.test.com.au</a> </div>
</div></body></html>
Die Sache, die mich wirklich ist verwirrt, aber, dass andere sehr ähnliche E-Mails ohne Probleme überhaupt senden!
Ich vermute, es gibt einen Anhaltspunkt, dass die erste Zeile der Ausgabe liest Docklands, VIC 3008 ...
Aber selbst wenn ich diesen Zeilenumbruch entfernen, um den Raum und das Komma (so liest es 123 Fake StreetDocklands
), beginnt der Ausgang Stills mit Docklands...
einschließlich der Platz am Anfang!