Forum Moderators: coopster

Message Too Old, No Replies

trouble with message in mail()

         

denisl

12:42 pm on Mar 29, 2010 (gmt 0)

10+ Year Member Top Contributors Of The Month



I am using mail() to send emails from a form but am having trouble with the message element with the following code.

$AdminMessage = "$name, Submitted the following Information:\n";
$AdminMessage .= "Email: $from\n";
$AdminMessage .= "Enquiring About: $PropName\n";
$AdminMessage .= "Address:\n";
$AdminMessage .= "$address\n";
$AdminMessage .= "Comments/Question:\n";
$AdminMessage .= "$comments\n";

If I just use the first line of the above code, all is fine. Any more than that however and the email ends in the spam bin.

Matthew1980

1:01 pm on Mar 29, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there densil,

Try this:-

$AdminMessage = $name.", Submitted the following Information:\n\r";
$AdminMessage .= "Email: ".$from."\n\r";
$AdminMessage .= "Enquiring About: ".$PropName."\n\r";
$AdminMessage .= "Address:\n\r";
$AdminMessage .= "$address\n\r";
$AdminMessage .= "Comments/Question:\n\r";
$AdminMessage .= $comments."\n\r";

Just concatonated the vars correctly, and put in the carraige return too, hopefully that will do the trick ;-p

As for "ending up in the spam bin", you nay need to do the mime type & set the headers correctly - or just say to the email client "Hey its not spam!"

Also ensure that you have the right amount of parameters in the mail function too..

Cheers,
MRb

denisl

1:17 pm on Mar 29, 2010 (gmt 0)

10+ Year Member Top Contributors Of The Month



Thank you Mathew

That has done the trick

Matthew1980

1:24 pm on Mar 29, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there denisl,

Apolgies for misspelling the name too ;)

Glad it worked, have fun with the rest of the project.

Cheers,
MRb