0

Following is how I am using the php mail function to send emails to registered users in my website:

mail($email, $subject, $message,'From: MySite <hello@mysite.com>', "-f hello@mysite.com");

The problem is that the recipients are getting 'From hello@mysite.com via eigbox.net'

How can I remove that eigbox.net? I searched on google and many are saying that you cannot remove it and some are saying that I should have that '-f hello@mysite.com', which as you can see I have but still it doesn't work. I even contacted my webhost but they were not very helpful.

Please let me know if there is anyway I can remove that and thank you very much.

maaz azad
  • 1
  • 1
  • 1

1 Answers1

3

Try the following:

$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$to = 'receipient@addre.ss';
$from = 'foo@bar.com';
$subject = 'e-mail subject';
$body = 'e-mail body';

mail($to, $subject, $body, $headers, "-f$from");

Unrelated note: I suggest using PHPMailer or Swiftmailer as an alternative to mail() function. It gives you more control and is robust.

  • Just tried it but it didn't work. My webhost is netfirms btw, and they use eigbox.net service to send emails. – maaz azad Sep 10 '13 at 13:25
  • @maazazad: I just tested this and it's working fine. Does the email get delivered? –  Sep 10 '13 at 13:28
  • Yeah the emails is getting delivered correctly except for this and yes I have used the same method every time for sending email for different websites on different host and never have I had such a problem. So it might be the host's fault, but I really need to know if I can do something to get rid of it. Thanks for your help . – maaz azad Sep 10 '13 at 13:35
  • @maazazad: I suggest using [PHPMailer](http://phpmailer.worxware.com/) instead. It's a lot better than the built-in `mail()` function. –  Sep 10 '13 at 13:37
  • 1
    I use PHPMailer and I have having this same problem. In my case (and most likely the OP's), it is because the site hosting and mail are using iPage which uses eigbox for their mail servers. Their support said there's nothing they can do so I'd suggest switching away from iPage. – Tony Paternite Feb 23 '15 at 04:39