Page 1 of 1
HTML emails are suddenly broken
Posted: Tue Apr 29, 2008 12:07 pm
by pickle
Hi all,
For some reason, HTML emails have started to be sent plaintext. All header information I'd send along to tell clients to read the email as HTML, are visible as plaintext in the body of the message.
I'm sure it's not my PHP code, as I've got two completely different implementations of sending HTML emails - they were both working before & they aren't any more. In fact, I'm using Swiftmailer in one implementation.
I'm guessing it's something to do with the server setup (hence my posting in this forum) - does anyone have any ideas?
Re: HTML emails are suddenly broken
Posted: Tue Apr 29, 2008 2:24 pm
by RobertGonzalez
Can you show the code? I only ask because the interface to Swift I wrote started sending plain text html mails today and it had to do with the way I set the mime type.
Re: HTML emails are suddenly broken
Posted: Tue Apr 29, 2008 3:01 pm
by pickle
Code: Select all
function SendMail($From,$FromName,$To,$ToName,$Subject,$Text,$Html,$AttmFiles=FALSE)
{
require_once('swiftmailer/Swift.php');
require_once('swiftmailer/Swift/Connection/SMTP.php');
$swift =& new Swift(new Swift_Connection_SMTP("mail.augustana.ca"));
$log =& Swift_LogContainer::getLog();
$log->setLogLevel(Swift_Log::LOG_EVERYTHING);
$message =& new Swift_Message($Subject);
$message->attach(new Swift_Message_Part($Text));
$message->attach(new Swift_Message_Part($Html,"text/html"));
if($AttmFiles)
{
foreach($AttmFiles as $path)
{
$message->attach(new Swift_Message_Attachment(new Swift_File($path),basename($path),"application/octet-stream"));
}
}
$recipients =& new Swift_RecipientList();
$to_list = explode(',',$To);
foreach($to_list as $curr_to)
{
$recipients->addTo($curr_to);
}
if(!$swift->send($message,$recipients,new Swift_Address($From,$FromName)))
echo "Email was not sent";
}
Re: HTML emails are suddenly broken
Posted: Tue Apr 29, 2008 3:39 pm
by RobertGonzalez
Comment out the line that set the text message part, just for testing, and see if that does it.
(that is what did it for me).
Re: HTML emails are suddenly broken
Posted: Wed Apr 30, 2008 2:17 pm
by pickle
That causes the email to be blank completely.
Re: HTML emails are suddenly broken
Posted: Wed Apr 30, 2008 2:32 pm
by RobertGonzalez
Is the html actually making into the function? Can you check that to make sure?
Re: HTML emails are suddenly broken
Posted: Wed Apr 30, 2008 5:02 pm
by pickle
Not sure what you mean? The html part is being put in the email.
Re: HTML emails are suddenly broken
Posted: Wed Apr 30, 2008 5:24 pm
by RobertGonzalez
That was a dumb question on my part. Have you looked at the headers in your email message that is received to confirm that the appropriate mime type is being sent?
Re: HTML emails are suddenly broken
Posted: Wed Apr 30, 2008 5:43 pm
by pickle
It doesn't look like they're being sent properly - a lot of them are showing up in the body of the email itself. It looks like the headers themselves might be buggered.
Re: HTML emails are suddenly broken
Posted: Wed Apr 30, 2008 5:55 pm
by RobertGonzalez
Have you upgraded Swift recently? Is it possibly a bug in the app?
If not that, maybe in the mail server?
Re: HTML emails are suddenly broken
Posted: Thu May 01, 2008 11:06 am
by pickle
I haven't touched Swift in a while. Nothing about the code has changed in 1/2 a year, which is why I'm thinking it's a server config thing.
Re: HTML emails are suddenly broken
Posted: Thu May 01, 2008 11:07 am
by RobertGonzalez
Just to check that, have you run any simple mailing tests outside of the app to see if the condition exists outside of the app?
Re: HTML emails are suddenly broken
Posted: Thu May 01, 2008 11:19 am
by pickle
I do have another email script that sends html emails (not using Swift) & they too are broken.
Re: HTML emails are suddenly broken
Posted: Thu May 01, 2008 11:36 am
by RobertGonzalez
Server issue. I concur with you.