so I’m trying to use PHP’s mail() function to send an email when users register.
For some reason though, it refuses to send to the company’s email. Are there some extra parameters that I might be missing that I would need for something like this, or do you think it is from the company’s email filtering these emails out?
EDIT:
Here’s some code:
$to = 'something@something.com';
$subject = 'New Web Registration';
$from = 'Quote Registration';
$headers = 'Content-type: text/html charset=iso-8859-1\r\n';
$headers .= 'From: ' . $from;
$body = '<table>
<tr>
<td style="text-align: right;">WebUserID:</td>
<td>' . $wuid . '</td>
</tr>
<tr>
<td style="text-align: right;">Name: </td>
<td>' . $regdata['Name'] . '</td>
</tr>
<tr>
<td style="text-align: right;">Company:</td>
<td>' . $regdata['Company'] . '</td>
</tr>
<tr>
<td style="text-align: right;">Address:</td>
<td>' . $regdata['Address'] . '</td>
</tr>
<tr>
<td style="text-align: right;">CSZ:</td>
<td>' . $regdata['City'] . ', ' . $regdata['State'] . ' ' . $regdata['Zip'] . '</td>
</tr>
<tr>
<td style="text-align: right;">Phone:</td>
<td>' . $regdata['Phone'] . '</td>
</tr>
<tr>
<td style="text-align: right;">Fax:</td>
<td>' . $regdata['Fax'] . '</td>
</tr>
<tr>
<td style="text-align: right;">URL:</td>
<td>' . $regdata['URL'] . '</td>
</tr>
<tr>
<td style="text-align: right;">Email:</td>
<td>' . $email . '</td>
</tr>
<tr>
<td style="text-align: right;">Comments:</td>
<td>' . $regdata['Comments'] . '</td>
</tr>
<tr>
<td style="text-align: right;">Customer Group:</td>
<td>' . $regdata['CustomerGroup'] . '</td>
</tr>
<tr>
<td style="text-align: right;">How Heard</td>
<td>' . $regdata['HowHeard'] . '</td>
</tr>
</table>';
if (!mail($to, $subject, $body, $headers)) {
echo 'Message delivery failed.';
}
And it does successfully email to other domains such as gmail. Delivery/filter problem?
If it is successfully sending to other domains than it is a problem with your company’s mail server. It’s possible that the emails are being filtered as spam or something similar.
An easy solution would be to use STMP, or you could try to find out why the are being filtered by looking at your mail server’s logs.
Make sure that you send an entire html message if you’re sending them as html. ( tags and all).