mail command not working, seeing it as SPAM?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
matharding
Forum Newbie
Posts: 2
Joined: Tue Aug 08, 2006 5:39 am

mail command not working, seeing it as SPAM?

Post by matharding »

Pimptastic | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi everybody I'm new here, and new to PHP too, I'm having trouble with the mail function where the mail reaches my email address fine in testing but when I change it to the clients address it never gets delivered.

Heres my code

Code: Select all

$to = "Steve.Nicholls@cornishvenning.co.uk"; 
$subject = "NEW QUOTE";
$headers = 'From: mat@t2design.net' . "\r\n" .
    'Reply-To: mat@t2design.net' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
$body = "QUOTE DETAILS\n"."\n"."FULL NAME\n".$full_name."\n"."\nADDRESS\n".$address."\n"."\nTOWN\CITY\n".$town."\n"."\nPOSTCODE\n".$postcode."\n"."\nCOUNTRY\n".$country."\n"."\nEMAIL\n".$email."\n"."\nTELEPHONE\n".$telephone."\n"."\nFAX\n".$fax."\n"."\n\nJOINT NAME\n".$joint."\n"."\nSECOND NAME\n".$second_fullname."\n\n";
$body .= "CONTACT TIME\n".$best_time."\n"."\nCONTACT METHOD\n".$respond."\n"."\nBUYING PRICE\n".$purchase_price."\n"."\nOWNER OCCUPATION\n".$own_occupation."\n"."\nMORTGAGE\n".$buy_mortgage."\n"."\nPROPERTY TYPE\n".$purchase_property."\n"."\nAREA\n".$buy_area."\n"."\nEXTRA INFO\n".$buy_info."\n"."\nSALE PRICE\n".$sale_price."\n"."\nPERSONAL RESIDENCE\n".$pers_residence."\n"."\nOWNER OCCUPATION\n".$own_occupation."\n"."\nHOW MANY MORTGAGES\n".$sell_mortgages."\n"."\nPROPERTY TYPE\n".$sell_property."\n"."\nAREA\n".$sell_area."\n"."\nEXTRA INFO\n".$pers_residence;
mail($to, $subject, $body, $headers);
I'm guessing it's something to do with the headers as my mail server accepts the mail as fine. Could it also be some sort of whitelist checking going on at my clients mail server that is treating the mail as spam?

Hope somebody can help, the mail command is brilliant when it works!


Pimptastic | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Not sure, really. Could be a number of things. Check that your mail IS being sent

Code: Select all

if(mail())
{
   echo 'sent';
} else
{
   echo 'could not send';
}
Check your DNS settings, http://www.dnsreport.com.
Also, does your mail server have an SPF record?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Are passing a correct "From" address?
matharding
Forum Newbie
Posts: 2
Joined: Tue Aug 08, 2006 5:39 am

Post by matharding »

Thanks, I shall post using the appropriate format next time, sorry about that.

Yeah the email From address is fine so that wont be the problem.

Ill try the email send check and the DNS settings too, thanks!
Post Reply