problematics with return path in emails

Events happening in the community are now at Drupal community events on www.drupal.org.
erik seifert's picture

Hello guys and girls,

We are a provider for PHP solutions, and our house cms is drupal. But we have the problem , that we can't set a return path. We must provide a special parameter to mail() . For sendmail is "-fmymail@togo.de" .

That's really a problem. But the solution is very simple. So why this feature is not planned or discussed in this group.

We must patch every installation of our drupal services and i hate this ;- (

Solution for 5 parameter

<?php
function drupal_mail_send($message) {
 
// Allow for a custom mail backend.
 
if (variable_get('smtp_library', '') && file_exists(variable_get('smtp_library', ''))) {
    include_once
'./'. variable_get('smtp_library', '');
    return
drupal_mail_wrapper($message);
  }
  else {
   
$mimeheaders = array();
    foreach (
$message['headers'] as $name => $value) {
     
$mimeheaders[] = $name .': '. mime_header_encode($value);
    }
    return
mail(
     
$message['to'],
     
mime_header_encode($message['subject']),
     
// Note: e-mail uses CRLF for line-endings, but PHP's API requires LF.
      // They will appear correctly in the actual e-mail that is sent.
     
str_replace("\r", '', $message['body']),
     
// For headers, PHP's API suggests that we use CRLF normally,
      // but some MTAs incorrecly replace LF with CRLF. See #234403.
     
join("\n", $mimeheaders),
     
'-f'.$message['from'] // patch for 5 parameter
   
);
  }
}
?>

Mail

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week