Hello All,

So I have set up a php form that takes user information and is suppose to send to the selected email address, but it is not sending to the email address.

When I tested the form on my local server it sent to the correct email address, but when it was uploaded to the server, it does not send to the selected address.

The php.ini file I think is where I am having problems. I spoke to the host but we didn't know how to fix the problem.

Any help would be appreciated.

Dani AI

Generated

Short, practical checklist for (and following up on 's RDNS suggestion):

Start by confirming what PHP on the server is actually using — create a tiny phpinfo() page to see which php.ini is loaded and what sendmail_path (if any) PHP is calling. (phpinfo() documentation). Next, remember that mail() only tells you whether the local MTA accepted the message for hand-off; it does not guarantee delivery — check the boolean return and server logs for the real cause. (PHP mail() reference).

Immediate tests to run

  • Confirm the active php.ini and the sendmail_path / mail.log / mail.force_extra_parameters settings. Ask the host to check the MTA logs and mail queue (typically in /var/log/maillog or /var/log/mail.log) if you don't have shell access. These PHP directives control how mail() hands messages to the system MTA and can also force an envelope sender. (PHP mail configuration)
  • Set an explicit From header and set the envelope sender so bounces/rejections come back to a known address (either with the 5th mail() parameter or mail.force_extra_parameters in php.ini).

Example (minimal) test script — use this to see accepted/rejected and to set an explicit envelope sender:

<?php
$to = 'you@examplerecipient.com';
$subject = 'php mail() test';
$message = "Test message\n";
$headers = "From: no-reply@yourdomain.com\r\nReply-To: no-reply@yourdomain.com\r\n";
$ok = mail($to, $subject, $message, $headers, '-fno-reply@yourdomain.com');
var_dump($ok);
?>

If the MTA accepts the message (true) but recipients never get it, ask the host to show delivery logs and whether outbound mail is being relayed, blocked, or marked as spam (rDNS, SPF, DKIM). If the host restricts PHP mail(), switch to authenticated SMTP (PHPMailer/SwiftMailer or a transactional SMTP relay) for reliable delivery.

Recommended Answers

All 6 Replies

Have you tried sending to another email address?

I assume you are using the standard mail() function. Also, check the host has RDNS correctly configured for the IP address(es) of the server.

Have you tried sending to another email address?

I assume you are using the standard mail() function. Also, check the host has RDNS correctly configured for the IP address(es) of the server.

Yes I have tried sending to several different email addresses and I am using the standard mail()function. What is RDNS?

So I looked in my php.ini file and found this it what the [mail function] looked like (Mind you the mail worked on my local host).

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =

I was researching at sitepoint.com and they gave this suggestion:

[mail function]
; Setup for Linux systems
sendmail_path = /usr/sbin/sendmail -t
sendmail_from =

Can you tell me the difference and do you think the hosting company should replace there selection with one of these, or will that screw everything up for them?

Well, your hosting company should have set the sendmail_path to the install dir of sendmail (unless you manage your own server) in which case it should be correct as the default value. The hosting company would be able to tell you if this was correct.

The sendmail_from will add a from to the mail headers if it was not specified in the mail() function.

Alright well that makes sense.

Thanks for your help.

I will see what I can do with the information you gave me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.