Closed (fixed)
Project:
SMTP Authentication Support
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Aug 2011 at 14:11 UTC
Updated:
12 Nov 2012 at 22:39 UTC
Using privatemsg email notification and smtp together causes the error:
Notice: Undefined index: charset in SmtpMailSystem->mail() (line 165 of /opt/local/apache2/htdocs/drupal_development/sites/all/modules/smtp/smtp.mail.inc).
Please find attached a patch
| Comment | File | Size | Author |
|---|---|---|---|
| undefined_index_fix-0.patch | 568 bytes | bochen87 |
Comments
Comment #1
fabianx commentedProbably a duplicate of #1330714: Character encoding conflict between Drupal and phpmailer., where there is a better fix. Closing for now ...
Comment #2
felixvang commentedinstead of line 165, what need to be fix as the error below:
Notice: Undefined offset: 1 in SmtpMailSystem->mail() (line 125 of /var/www/drupal/sites/all/modules/smtp/smtp.mail.inc).
Notice: Undefined offset: 1 in SmtpMailSystem->mail() (line 125 of /var/www/drupal/sites/all/modules/smtp/smtp.mail.inc).
Unable to send e-mail. Contact the site administrator if the problem persists.
anyone?
Comment #3
loze commentedI was getting this when sending an email using rules and smtp
your patch fixed it. Thanks.
Comment #4
P3t3r commentedLatest version:
Undefined index: charset in SmtpMailSystem->mail() (line 165 of /var/www/mysitename/sites/all/modules/smtp/smtp.mail.inc).
so the problem is still happening even though the other topic claims to have solved the character issue.
The problem only happens when using mimemail. When using htmlmail, the problem does not appear. However, mimemail is by far the most used way to send html mails, so a fix would be appreciated.
Comment #5
SolomonGifford commentedThe following:
should become:
Comment #6
diegodf commentedIt worked perfect. I wonder what makes this modification to work
Comment #7
nikolaosinlight commentedThis module assumes that a content-type always specifies a charset... which is the case in a simple say plain-text email w/o attachment e.g.:
However, multipart emails such as for example HTML emails with plain-text alternative have charset embedded in the content-type of the multi-part sections and not necessarily always in the content-type of the email itself e.g.:
The better approach is for this module to look for, but not assume that charset is set on the content-type of the email. So the patch resolves this nicely and IMO should be implemented in the module if at the very least it is more defensive coding.
Comment #8
nikolaosinlight commentedFound a problem with the patch. In the case of a HTML email with plain-text alternative the patch yields:
Which I presume is some system wide PHP default or something. In any event, if the charset is not specified directly in the email Content-Type I would think its best to simply assume that it is UTF-8 vs. doing nothing otherwise things like HTML entities e.g. © will not render properly not to mention other content.
So I propose that the code be altered to as follows:
So this altered code accomplishes what the author intended with the patch AND provides a much better default IMHO than setting no charset at all or forcing someone to try to change some system wide PHP setting or something.
Comment #9
dromansab commentedHere there is a patch that works for me http://drupal.org/node/1330714#comment-5232856
Comment #10
fabianx commentedIs this still a problem in 7.x-1.0-beta2?
It seemed that the patch from #1330714: Character encoding conflict between Drupal and phpmailer. had been commited already ...
Best,
Fabian
Comment #11
haydeniv commentedI can confirm this has been fixed in beta2