Jump to content

How To Include Symbols - When Sending Php Mail..?


cyfer65
 Share

Recommended Posts

I have a working PHP mail sending script, the only problem is that when i try to send any kinda symbol in Either the Message Title or the Message body it messes up the text..Like if i wanted to put quotes in the title or embed a picture into the message body with <img src='pic.jpg' /> it gets all messed up..!!is there any specific way to make it so I can include these symbols so the message don't get ruined..??

<?php$to=$_POST["to"];$from=$_POST["from"];$name=$_POST["name"];$subject=$_POST["subject"];$message=$_POST["message"];$headers = "From: \"$name\" <$from>\nContent-Type: text/html; charset=iso-8859-1";$ret=mail("$to", "$subject", "$message", "$headers");if($ret==true)echo"Mail sent Successfully";elseecho"Unable to Send mail";?>

Edited by cyfer65
Link to comment
Share on other sites

like if i put something in "Quotes" it will do this to it on the recipients mail \"Quotes\" or if i try to embed a picture in the message body with <img src='http://pic.jpg' /> it removes parts of the embed string on the recipients email..??is there something missing or wrong in my PHP code that would be doing this..??

Link to comment
Share on other sites

The quotes problem happens because of PHP's "Magic Quotes". It's a system that automatically adds quotes to input strings so that scripts made by amateur developers don't allow the database to be hacked.You can determine if Magic Quotes are on by using the get_magic_quotes_gpc() function and then remove them using stripslashes().

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...