Jump to content

Trouble Sending HTML Email with PHP


Shadow Jolteon

Recommended Posts

Hello. =)

 

I have been working on a registration system for my website, and everything is going great, except for the verification email... I have never worked with the mail() function before, and have no idea what I am doing wrong. Whenever I submit the form, it sends the email, but for some reason, the HTML is sent as an attachment to the email, which is blank.

	$emailHeaders = 'MIME-Version: 1.0'."\r\n";
	$emailHeaders .= 'Content-type: text/html; charset=iso-8859-1'."\r\n";
	$emailHeaders .= 'To: '.$registeredName.' <'.$registeredAddress.'>'."\r\n";
	$emailHeaders .= 'From: Site Name <[email protected]>'."\r\n";

	mail($registeredAddress, 'Account Verification', $emailContent, $emailHeaders);

 

Any help with this would be greatly appreciated. Thanks! =)

Link to comment
https://forums.phpfreaks.com/topic/169594-trouble-sending-html-email-with-php/
Share on other sites

Follow the examples here: PHP: mail - Manual. There's an example with HTML emails.

 

Also, make sure your email client does in fact support HTML emails. If it does, is it turned on for that particular address? Maybe there's a security option in your email client that restricts parsed HTML emails if you don't know the sender.

Yeah, I've read through the PHP mail function manual a bunch of times already... =/

 

And, yes, my email client definitely supports HTML email, and it is turned on. =) I've never had any trouble receiving HTML email in the past, even from unknown senders. Also, I've tested this on two separate clients, just to make sure, and I get the same results...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.