2

I have many emails, gmail and other and I try to send an email to each. Actually, only 1 email receive the message, the other, gmail for example, doesn't.

With linux : The command echo "Hi" | mail -s "test" [email protected] works fine.

But with PHP, the mail do not go....

I have no error in my mail.log. Have you any ideas ?

Thanks !

Edit : I'am on a linux server.

4
  • 5
    php's mail() is useless garbage. try using Swiftmailer or PHPMailer instead, both of which offer far better diagnostics for mail problems. Commented Apr 22, 2013 at 16:08
  • Show us whathaveyoutried.com - maybe by using a sscce.org Commented Apr 22, 2013 at 16:09
  • 1
    Is your SMTP configured and is the PHP set to use it? Show us your PHP code and the error you get, please. Commented Apr 22, 2013 at 16:11
  • I have many servers and i never have problems, in my php.ini i have SMTP = localhost smtp_port = 25 Commented Apr 22, 2013 at 16:12

1 Answer 1

1

Try something like this:

$mail = new PHPMailer(); // defaults to using php "mail()"
$body = $mailBody;
$mail->SetFrom('[email protected]'); 
$mail->AddAddress('[email protected]', 'Your Name');

$mail->Subject = 'The subject';
$mail->MsgHTML('The body');
$mail->Send();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.