Sent emails are being rejected

Hi I’ve noticed that mails I’m sending via the php mail() function are being rejected by a number of mailservers.
It looks like the servers in question have been configured to do “Sender Address Verification” as can be seen in this snippet from the postfix log on one I can access:

>>> START Sender address RESTRICTIONS <<<
generic_checks: name=reject_unknown_sender_domain
reject_unknown_address: 121810@us-imm-node1b.000webhost.io
ctable_locate: move existing entry key 121810@us-imm-node1b.000webhost.io
reject_unknown_mailhost: us-imm-node1b.000webhost.io
lookup us-imm-node1b.000webhost.io type MX flags 0
dns_query: us-imm-node1b.000webhost.io (MX): Host not found
lookup us-imm-node1b.000webhost.io type A flags 0
dns_query: us-imm-node1b.000webhost.io (A): Host not found
lookup us-imm-node1b.000webhost.io type AAAA flags 0
dns_query: us-imm-node1b.000webhost.io (AAAA): Host not found
NOQUEUE: reject: RCPT from us-imm-postlady1.000webhost.io[153.92.0.72]: 450 4.1.8 <121810@us-imm-node1b.000webhost.io>: Sender address rejected: Domain not found; from=<121810@us-imm-node1b.000webhost.io> to=<flying@c-hacker.co.uk> proto=ESMTP helo=<us-imm-postlady1.000webhost.io>
generic_checks: name=reject_unknown_sender_domain status=2
>>> END Sender address RESTRICTIONS <<<

As you can see the DNS lookup on the name of the sending mailserver “us-imm-node1b.000webhost.io” is failing and causing the message to be rejected as the originating mailserver is not to be trusted.

So my question is: Is there a way to send email via php mail() that come from a server that is DNS resolvable or is there a way to send mails from php using another smtp server?

Or am I out of luck and will have to move the site elsewhere?

Hi @netnode1

Please share the complete mailing code with us :slight_smile:

This is the mail sending code I’ve written:

$email = $input[‘email’];
$name = $input[‘name’];
$subject = “Flight School enquiry $name”;
ob_start();
$time = new DateTime(“now”, new DateTimeZone(“Europe/London”));
echo(“Time sent:” . $time->format(“Y-m-d H:i:s”) . “\n”);
echo(“Contact name:$name\n”);
echo(“Contact email:$email\n”);
echo(“Contact telephone:” . $input[‘telephone’] . “\n”);
echo(“Contact mobile:” . $input[‘mobile’] . “\n”);
echo(“Comment:” . $input[‘comment’] . “\n”);
$message = ob_get_contents();
ob_end_clean();
if(mail(‘a@validaddress.com’, “Subject: $subject”, $message, “From: $email”))
{
  $file = fopen("…/tmp/records.txt",“a”);
  if ($file)
  {
    $record = urlencode($message) . “/n”;
    fputs($file,$record);
    fclose($file);
  }
}

Please include headers in your email. Otherwise providers will discard it.

I am including a From header, what others are required?

I am including a From header,

I did not see it.

What is your website address?

It’s passed directly in as the 4th argument to mail().

Website is http://www.flysnowdonia.com but it’s not live yet (And so access is restricted) as I need to solve this mail sending issue first.

I have checked your site. We are currently experiencing issues with our mailing infrastructure.

We are sorry for inconvenience :sweat:


I can also certify that some mailing providers have blocked our mailing servers because the first ones have been abused over time. There isn’t much we can do about this unfortunately.

1 Like