Missing from address & multiple headers
Andreas Kohlbecker - July 5, 2007 - 16:07
| Project: | SMTP Authentication Support |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | oadaeh |
| Status: | closed |
Description
When trying out the smtp module I found two bugs which prevented mails from being accepted by our server:
- The
Fromwas missing in the header - Some header entries occurred double e.g.:
Content-Type
So our server rejected these mails, which is absolutely correct, since such mail is invalid.
To fix these issued I introduced a from address field into the settings form. Sure, you can set the smtp_from elsewhere; however it is highly desirable to have it also in the settings of the very module. Furthermore I fixed the multiple header problem in drupal_mail_wrapper()
Currently we are doing some maintenance on our SVN server so I rather submit a link to fixed module in a zip file, but to publish the link to the repository: http://wp5.e-taxonomy.eu/download/smtp_fixed_2007-07-05.zip

#1
I looked over and tested the changes in your file and it works great. I've made a cvs patch for the changes.
Changes:
1. Added a From Field option to the config page. The address will be used if the from field is empty when the system is going to send.
2. Several header modifications to ensure headers are correct.
3. Added a development debug option on line 246.
@Andreas: The only change I didn't include in the patch is below because I was not sure exactly what it was doing.
if($this->do_debug >= 2) {
echo "sending line:" . $line_out . $this->CRLF;
}
Disclaimer: All work in this patch was done by Andreas Kohlbecker. I only reviewed, copied, tested, and created a cvs patch for the code.
Thanks Andreas.
#2
I just applied this patch and it works great. It fixed a problem for me where sending email would fail with (in watchdog):
Error sending email: "The following From address failed: username " From: "username " To: "user@email.ca"#3
The headers fix has been committed here: http://drupal.org/cvs?commit=90617
I did not include all the extra header checks, just the main one. I can add the extra ones if still necessary when I get done with everything else I'm trying to accomplish.
#4
Committed the admin from field here: http://drupal.org/cvs?commit=90660
The rest of the headers have been committed here: http://drupal.org/cvs?commit=90661
#5
Automatically closed -- issue fixed for two weeks with no activity.