Question

I'm trying to set up a custom mailing list for my site.

When a user(user@bar.com) sends a mails to list@foo.com. The mail should automatically be sent to the subscribers.

Making the actual sending isn't that hard. But when the emails get delivered I get the "This message may not have been sent by..." warning.

This doesn't look to Cool.

First:

  1. How do I prevent this message from showing (Most important)
  2. How can I make the receiver see the list@foo.com address instead of their own. (Like google's mailing lists)

Note: The receiver should still be able to see the actual sender in the from field.

I've read some other posts on the topic, mentioning all kinds off different headers. But I Can't seem to get it to work.

I'm using PHPmailer and heres a part of my code:

<?php
    include(class.phpmailer.php);
    $real_to = "user@bar.com";
    $mail = new PHPMailer();
    $mail->IsMail();
    $mail->AddReplyTo($_POST['from_mail'], $_POST['from_name']);
    $mail->Host = "mail.foo.com";
    $mail->From = $_POST['from_mail'];
    $mail->Sender = "list@foo.com";
    $mail->MessageID = $_POST['msgID'];
    $mail->FromName = $_POST['from_name'];
    $mail->AddAddress($listmail);
    $mail->Subject  = $_POST['subject'];
    $mail->ContentType  = $_POST['content_type'];

    $mail->addCustomHeader("X-BeenThere: " . $listmail);
    $mail->addCustomHeader("Precedence: list");
    $mail->addCustomHeader("Precedence: list");
    $mail->addCustomHeader("Envelope-To: " . "list@foo.com");
    //$mail->addCustomHeader("Received: " . $_POST['received']);
    $mail->Body = $_POST['body'];
    $mail->Send();
?>
Was it helpful?

Solution 2

I ended up making a cronjob that updated the mail list adding all recipients as aliases instead. This solved all wierd message about the massage not originating from the sender. I dont know if this is a good method. But it works.

I also added a PTR reccord. Installed DKIM suport and set up a SPF reccord. This solved all spam marking.

Now the problem is solved.

OTHER TIPS

I'm not so sure about what is needed in php code, but here are some general mail-server tips. It is possible that some of your problem might lie in your header information or in your mail-server's configuration.

When I used our local mailserver to send messages to mailing lists, I discovered that people were not receiving mail on certain domains. When I looked through the mail server logs (hMailServer) I saw that the server on the recipient was rejecting the messages.

The problem turned out to be that my domain was missing a reverse ip lookup registration in the ISP's domain settings.

I believe this can also be the source of some mail recipients getting your messages tagged with spam notices and warnings (as your case may be).

Another point to consider is that you have a return-path address specified in your headers - this is not the same as the reply address - it is a setting used by mail-servers when they talk to each other. Check out this little troubleshooting guide.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top