0

Below script was working fine till when i changed the message to "domain.org". Now its showing success message but im not receiving any emails even not in spam. If I change the message to "domain.com" its working fine.

    $from = "info@domain.com";
    $to = "testmail@gmail.com";
    $subject = "PHP Mail Test script";
    $message = "domain.org";
    $headers = "From:". $from;
    $mail = @mail($to,$subject,$message, $headers);
    if($mail){
    echo "Test email sent";
    }else{
    echo "Mail not sent";
    }

Any idea to solve this?

Synchro
  • 35,538
  • 15
  • 81
  • 104
Amiyar
  • 83
  • 1
  • 12
  • Could you remove @ from @mail and post errors if any ? – vincenth Sep 07 '16 at 07:45
  • Check your mail server logs. – Synchro Sep 07 '16 at 07:56
  • @ vincenth, yes i tried using both mail and @mail, but not working. – Amiyar Sep 07 '16 at 08:22
  • @ Synchro, k I will check it. – Amiyar Sep 07 '16 at 08:23
  • Just stating the obvious but, the fact mail() returns true means the e-mail was accepted for delivery. According to the documentation "just because the mail was accepted for delivery, it does NOT mean the mail will actually reach the intended destination". Have you tried to add more text along with the domain ? – vincenth Sep 07 '16 at 09:01
  • @vincenth, yup tried that too. Still fails. – Amiyar Sep 07 '16 at 09:07
  • @Amith, what happens if the domain in $message is the same than the one in $from ? Could you try : $from = 'info@domain.org'; $message = 'domain.org'; ? – vincenth Sep 07 '16 at 09:10
  • @vincenth, tried many changes like that but its working only when i change the $message value. for ex. domain.com,domain-org etc are working. I think the domain name is black listed! is there any possibility for that? – Amiyar Sep 07 '16 at 09:33
  • @vincenth, if i change the $message value as "wordpress.org" its fine. – Amiyar Sep 07 '16 at 10:28
  • Thanks, Please upvote the question also. – Amiyar Mar 10 '18 at 07:15

0 Answers0