a mail() problem...

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
Charles256
DevNet Resident
Posts: 1375
Joined: Fri Sep 16, 2005 9:06 pm

a mail() problem...

Post by Charles256 »

why is it giving me htat output? it's like it totally ignored the fact I wanted to send a html e-mail...what gives?

mail code..

Code: Select all

{
			echo ("Thank you $Fname $Lname for your entry. You will recieve an e-mail shortly and then you will have to confirm your entry.");
			$message="Thank you for registering $Fname $Lname.\nYour user name is:$Lname .\nYour password is: $Password .\nPlease return to <a href='asite.html'> the site. </a> to confirm your registration.\nThank you!\n\nCompany.\n\nIf you feel you recieved this message in error please reply to this e-mail address with the word remove in the subject and the situation will be corrected.\nWe apologize for any inconvinience this created.\n";
			$headers  = 'MIME-Version: 1.0' . "\r\n";
			$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

			$headers .= "To: $Fname <$Email>' . '\r\n'";
			$headers .= 'From: Company <company@company.com>' . "\r\n";
			$to="$Email";
			$subject="Thank you for entering our Give Away!";
			mail($to,$subject,$message,$headers);
		}
the output....

Code: Select all

Content-type: text/html; charset=iso-8859-1

To: okay <myemail@address.com>, '.'@host218.ipowerweb.com
'From: Carter Brothers <someone@someone.com>

X-DCC-ipwdcc-1-Metrics: random host info 208; Body=1 Fuz1=1 Fuz2=1


Thank you for registering okay okay.
Your user name is:okay .
Your password is:the correct password
Please return to <a href='asite.html'> the site. </a> to confirm your registration.
Thank you!

Carter Brothers.

If you feel you recieved this messag ein error please reply to this e-mail address with the word remove in the subject and the situation will be corrected.
We apologize for any inconvinience this created.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: a mail() problem...

Post by RobertGonzalez »

Charles256 wrote:why is it giving me htat output? it's like it totally ignored the fact I wanted to send a html e-mail...what gives?

mail code..

Code: Select all

...
			$headers  = 'MIME-Version: 1.0' . "\r\n";
			$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

			$headers .= "To: $Fname <$Email>' . '\r\n'";
			$headers .= 'From: Company <company@company.com>' . "\r\n";
			$to="$Email";
			$subject="Thank you for entering our Give Away!";
			mail($to,$subject,$message,$headers);
...
Try using either only double quotes OR only single quotes in your string concatination. See if that helps.

Code: Select all

...
			$headers  = "MIME-Version: 1.0\r\n";
			$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

			$headers .= "To: $Fname <$Email>\r\n";
			$headers .= "From: Company <company@company.com>\r\n";
			$to="$Email";
			$subject="Thank you for entering our Give Away!";
			mail($to,$subject,$message,$headers);
...
This is just a quick thought. It could just as easily be a mail server misinterpretation or PHP mishap.
Charles256
DevNet Resident
Posts: 1375
Joined: Fri Sep 16, 2005 9:06 pm

Post by Charles256 »

i found this with Roja's help. http://phpmailer.sourceforge.net/
get it and love it!:-D
Post Reply