All of the emails that our site sends out use the default site address, which is "DoNotReply@sitename.com" -- but the friend notifications are coming from the actual email address of the user requesting friendship. This is a big problem for us, because we want to mask our user's email addresses for privacy reasons.

There should probably be an admin option that allows you use the default site email as From address in outgoing emails, in order to mask the user's actual address. We want the user's username to show up in the from field, just not their address.

Comments

friolator’s picture

I've been digging through the flag_friend code, and I'm not really seeing any obvious place where the return address is sent. but the strange thing is that it's only in flag_friend that we're getting messages with the user's email as the return address. Any ideas?

sirkitree’s picture

Hrm, kinda strange. We're using drupal_mail() and if you look at the documentation, the from_address is NULL by default. In flag_friend, we do not specify it, so it should be pulling the site_mail

API:

function drupal_mail($module, $key, $to, $language, $params = array(), $from = NULL, $send = TRUE) {
  $default_from = variable_get('site_mail', ini_get('sendmail_from'));
...

flag_friend:

drupal_mail('flag_friend', $email['type'], $recipient->mail, $language, $email);
...
friolator’s picture

Well, drupal_mail isn't getting called, messaging_message_send_user() is, because we have messaging installed. It's Messaging that's handling the sending, because we allow users to receive messages via privatemsg or email, all queued through the messaging framework...

<?php
        if (function_exists('messaging_message_send_user')) {
          messaging_message_send_user($recipient, $email, NULL, 1);
        }
?>
friolator’s picture

So the problem here seems to be with messaging. I've opened a feature request there for this: #607372: Feature Request: Add a "From" field preference to Messaging Settings

sirkitree’s picture

Status: Active » Closed (works as designed)