Blank Subject with Phpmailer on Zend i5/OS
An online job application system that emails an administrator the application once it was submitted wasn't sending the email. On my local machine it worked fine, but as soon as I tried on wcdev it didn't work. The first fix was to use Phpmailer since Zend i5/OS doesn't support the mail() function.
So the emails were being sent but a lot of times there was no subject line, or in other words it was left blank. After much trial and error and many file pushes thanks to Ryan, I figured out that it only happens when there is a file attached to the email.
After more exploration I saw that the subject was being passed correctly to the send function, but that it still wasn't being set for some reason.
For one reason or another Zend ignores the subject field in the mail() function, but everything in the body and headers was showing correctly.
So the quick fix I found is to set the subject in the email header. So far it is working just like it should.
The quick hack is on line 909 or so of the PHPMailer class file:
/* mail() sets the subject itself */ // if($this->Mailer != 'mail') { // $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject))); // } //The subject must be set in the header for the Zend i5/OS $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject))); |
Print This Post