Commit 4c2460be authored by smk-ka's avatar smk-ka

#607204 by dagmar, smk-ka: Fixed unable to reply to e-mails sent via Google...

#607204 by dagmar, smk-ka: Fixed unable to reply to e-mails sent via Google Mail. Added an option to always set a "Reply-To" address.
parent 67cb0199
......@@ -82,11 +82,11 @@ Optional:
Username: your_google_mail_name@gmail.com
Password: your_google_mail_password
Note however, that Google automatically rewrites the "from" line of any e-mail
you send via their SMTP gateway to your Google Mail address. Also note the
sending limits [1] for Google Mail accounts.
In Advanced SMTP settings:
Enable 'Always set "Reply-To" address' checkbox.
[1] http://mail.google.com/support/bin/answer.py?hl=en&answer=22839
Also note the sending limits for Google Mail accounts:
http://mail.google.com/support/bin/answer.py?hl=en&answer=22839
* Debug settings
......
......@@ -24,10 +24,10 @@ function phpmailer_send($message) {
try {
// Parse 'From' e-mail address.
$address = phpmailer_parse_address($message['from']);
$mail->From = $address[0]['mail'];
if ($address[0]['name'] != '') {
$mail->FromName = $address[0]['name'];
$from = reset(phpmailer_parse_address($message['from']));
$mail->From = $from['mail'];
if ($from['name'] != '') {
$mail->FromName = $from['name'];
}
unset($message['headers']['From']);
......@@ -61,6 +61,11 @@ function phpmailer_send($message) {
}
unset($message['headers']['Reply-To']);
}
elseif (variable_get('smtp_always_replyto', FALSE)) {
// If no Reply-To header has been explicitly set, use the From address to
// be able to respond to e-mails sent via Google Mail.
$mail->AddReplyTo($from['mail'], $from['name']);
}
// Extract Content-Type and charset.
if (isset($message['headers']['Content-Type'])) {
......
......@@ -29,11 +29,11 @@ function mimemail_phpmailer_send($message) {
// Display names are usually not required. Leave header intact.
// Parse 'From' e-mail address.
$address = phpmailer_parse_address($message['sender']);
if ($address[0]['name'] != '') {
$mail->FromName = $address[0]['name'];
$from = reset(phpmailer_parse_address($message['sender']));
$mail->From = $from['mail'];
if ($from['name'] != '') {
$mail->FromName = $from['name'];
}
$mail->From = $address[0]['mail'];
if (variable_get('phpmailer_debug_email', '') === '') {
// Set recipients.
......@@ -65,6 +65,12 @@ function mimemail_phpmailer_send($message) {
$message['headers']['To'] = $message['address'];
}
// If no Reply-To header has been explicitly set, use the From address to be
// able to respond to e-mails sent via Google Mail.
if (!isset($message['headers']['Reply-To']) && variable_get('smtp_always_replyto', FALSE)) {
$message['headers']['Reply-To'] = $from['mail'];
}
$message['headers']['Subject'] = $message['subject'];
// FIXME SpamAssassin says INVALID_MSGID to PHPMailer's generated Message-ID. 06/04/2009 smk
......
......@@ -119,6 +119,12 @@ function phpmailer_settings_form() {
'#default_value' => variable_get('smtp_fromname', ''),
'#description' => t('Enter a name that should appear as the sender for all messages. If left blank the site name will be used instead: %sitename.', array('%sitename' => variable_get('site_name', 'Drupal'))),
);
$form['advanced']['smtp_always_replyto'] = array(
'#type' => 'checkbox',
'#title' => t('Always set "Reply-To" address'),
'#default_value' => variable_get('smtp_always_replyto', 0),
'#description' => t('Enables setting the "Reply-To" address to the original sender of the message, if unset. This is required when using Google Mail, which would otherwise overwrite the original sender.'),
);
$form['advanced']['smtp_keepalive'] = array(
'#type' => 'checkbox',
'#title' => t('Keep connection alive'),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment