HDFilmMaker2112 Posted June 12, 2012 Share Posted June 12, 2012 How would I go about sending HTML through the mail() function? I'm currently using <br/> tags <a> tags and when I run the script and have the email sent to me, all the tags are visible. /*Generate activation email*/ $to=$register_email; $subject='Activate Your Kynxin Membership'; $headers='From: support@kynxin.com'; $message='Thank you for registering for Kynxin.<br/> <br/> Please visit the following link to activate your account. <a href="http://www.kynxin.com/signup/activate.knxn?activate='.$activation_number.'"> http://www.kynxin.com/signup/activate.knxn?activate='.$activation_number.'</a> <br/> <br/> Thank You,<br/> The Kynxin Support Team '; /*Send registration activation email*/ mail($to, $subject, $message, $headers); Quote Link to comment https://forums.phpfreaks.com/topic/264071-sending-html-in-mail/ Share on other sites More sharing options...
Barand Posted June 12, 2012 Share Posted June 12, 2012 add another header content-type: text/html Quote Link to comment https://forums.phpfreaks.com/topic/264071-sending-html-in-mail/#findComment-1353287 Share on other sites More sharing options...
boompa Posted June 12, 2012 Share Posted June 12, 2012 You really should consider using something like PHPMailer. It will make your life easier where this is concerned. Quote Link to comment https://forums.phpfreaks.com/topic/264071-sending-html-in-mail/#findComment-1353288 Share on other sites More sharing options...
HDFilmMaker2112 Posted June 12, 2012 Author Share Posted June 12, 2012 add another header content-type: text/html Crap, thank you. Can't believe I missed that. Quote Link to comment https://forums.phpfreaks.com/topic/264071-sending-html-in-mail/#findComment-1353289 Share on other sites More sharing options...
HDFilmMaker2112 Posted June 12, 2012 Author Share Posted June 12, 2012 You really should consider using something like PHPMailer. It will make your life easier where this is concerned. That just seems like it adds so much overhead to something that should be so simple. You have to add another file in, additional processing, etc. I just don't see what advantage that has over the regular mail() function. Quote Link to comment https://forums.phpfreaks.com/topic/264071-sending-html-in-mail/#findComment-1353300 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.