Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Emailing to Exchange Server Problem

My emails aren't going through to a Windows exchange sever

11:55 pm on Nov 1, 2008 (gmt 0)

Junior Member

5+ Year Member

joined:Sept 6, 2008
posts: 50
votes: 0

I'm still pretty new to PHP and am having problems with my email script. My form will successfully send mail to my Comcast, Hotmail, Yahoo, and a couple other email accounts, but my work email which is on a Windows exchange server isn't receiving anything. Can someone please help me? Here's the PHP code I've been working with:

$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$to = $_POST['to'];
$message = $_POST['message'];
$submit = $_POST['submit'];

// Check if the form has been submitted.
if (isset ($submit)) {

$problem = FALSE; // No problems so far.

// Check each value.
if (empty ($name)) {
$problem = TRUE;
print '<div class="form_error">Error: Please enter your name.</div>';

if (empty ($email)) {
$problem = TRUE;
print '<div class="form_error">Error: Please enter your email address.</div>';

if (empty ($message)) {
$problem = TRUE;
print '<div class="form_error">Error: Please enter your message.</div>';

if (!$problem) { // If there weren't any problems...
print '<div class="form_success">Thanks for contacting us! Someone will get back to you shortly.</div><br />';

// Send the email.
$body = $name . "\n" . $email . "\n" . $phone . "\n\n" . $message;

mail ($to, 'Message from AEID Website', $body, 'From: ' . $name);

} else { // Forgot a field.

print '<br />';



12:48 pm on Nov 2, 2008 (gmt 0)


WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 24, 2001
votes: 0

my guess is it is getting seen as spam. You should check the folder that your spam is sent to and see if it's there.

The easy way to fix this is to whitelist the address it is coming from.

The real way to fix it is to properly construct the headers of the email to set enough values so your mail server doesn't think it's spam. The things to do could be much longer than that too because this can also rely on mail server settings on both sides of this communication as well.

looking to see if the message was sent to spam is the first step. Then look at the actual headers on the message you received is next.

6:18 pm on Nov 2, 2008 (gmt 0)

Junior Member

5+ Year Member

joined:Sept 6, 2008
posts: 50
votes: 0

That was my thought too, but both my spam and my junk email folders are empty.

I contacted a programmer friend of mine at the same time I posted this thread and he told me the same thing, that I'm missing headers. He also pointed out that the script I'm using is very dangerous in that it will allow tons of spam to come through, so he suggested abandoning this script and finding a fully-developed script somewhere else. I don't fully understand how my script could be abused like that, but I trust him and am going to take his advice. Thank you for your help and advice though, jatar_k!


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members