Hi guys pls i want to change my email title. Eg my email, admin@gmail.com. Now when i send the email the title is always 'Admin'. Now i want to change it to my own tile. Plse help
help in Email title
Started on the old forum in June 2012 · view the original in the archive · old links redirect here
hmmm.....
$headers .= 'From: I am not admin <i-am-not-admin@example.com>' . "\r\n";
mail($to, $subject, $message, $headers);
Advertise your mobile site for FREE with AdTwirl
post the file your having trouble with in either php tags or attachment. then we can have alook and help. but changing your email name in title IS as easy as gums has shown really.
heres an email (invite) script i created recently was gonna be for mobile chat script. but im having a little issue myself. its sending to my spam box rather than inbox (didnt use to do this)
but anyway, this is how easy it is to change this in headers.
<?PHP
header("Content-type: text/html; charset=UTF-8");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n";
include("config/config.php");
echo "<head>";
echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" />";
echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\"/>";
echo "<title>$sitename's Invite</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheets/stylesheet.css\" media=\"handheld,screen,projection\" />";
echo "</head>";
echo "<body class=\"body\">";
echo "<div>";
/* NOW TIME FOR THE MAIN PAGE */
if (!isset($_POST['submit']))
{
echo "<b>Send an invite for one of your friends to join our site:</b><br/><br/>";
echo "<form method=\"post\" action=\"secret.php\" >";
echo "Send to email:";
echo "<br/>";
echo "<input type=\"text\" name=\"email\" value=\"@\" maxlength=\"70\" />";
echo "<br/>";
echo "Your email:";
echo "<br/>";
echo "<input type=\"text\" name=\"fromemail\" value=\"@\" maxlength=\"70\" />";
echo "<br/>";
echo "Your Name:";
echo "<br/>";
echo "<input type=\"text\" name=\"from\" value=\"\" maxlength=\"70\" />";
echo "<br/>";
echo "<input type=\"submit\" value=\"Send Email\" name=\"submit\"/>";
echo "<br/><br/>";
echo "<a href=\"../index.php\">Back</a>";
echo "<br/>---<br/>$copyright";
echo "</form>";
}
/* NOW TIME FOR THE CONFIRMATION PAGE */
if (isset($_POST['submit']))
{
$email = htmlentities(stripslashes($_POST['email']), ENT_QUOTES, 'UTF-8');
$fromemail = htmlentities(stripslashes($_POST['fromemail']), ENT_QUOTES, 'UTF-8');
$from = htmlentities(stripslashes($_POST['from']), ENT_QUOTES, 'UTF-8');
if ($email == "" OR $fromemail == "" OR $from == "")
{
echo "Please fill in All fields!!<br/>---<br/>";
echo "<a href=\"secret.php\">« Back</a>";
echo "<br/>---<br/>$copyright";
}
else
{
/* YOUR SITE AND SUBJECT INFORMATION GOES HERE! */
$site = "http://scripting.uk.to";
$subject = "Invitation";
/* AND YOUR MESSAGE INFORMATION GOES HERE */
/* HERES MY EXAMPLE INVITE */
$message = "
this is not a spam email.
it was sent to you from $from who's email is $fromemail
they have invited you to join this site $site
if you dont know the person who has sent this message or you do not
wish to join please dis-regard this email
------------------------------------------
if you constantly get messages from this person/site
please feel free to go to the site and let the owner know and
they will make sure it is stopped and you have no further problems..
";
$headers = "From: $from <$fromemail>\n";
$headers .= "Reply-To: <$fromemail>\n\n";
mail($email,$subject,$message,$headers);
echo "Thanks $from! Your message has been sent to $email!<br/>";
echo "---<br/><a href=\"secret.php\">home</a>";
echo "<br/>---<br/>$copyright";
}
}
echo "</div>";
echo "</body>\n";
echo "</html>\n";
?>
//
//
//
//
//
im sure ill figure out my issue. but this should help you discover yours viewing a full setup.
Ghost wrote: post the file your having trouble with in either php tags or attachment. then we can have alook and help. but changing your email name in title IS as easy as gums has shown really.
heres an email (invite) script i created recently was gonna be for mobile chat script. but im having a little issue myself. its sending to my spam box rather than inbox (didnt use to do this)
but anyway, this is how easy it is to change this in headers.
<?PHP header("Content-type: text/html; charset=UTF-8"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"; echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n"; include("config/config.php"); echo "<head>"; echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" />"; echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\"/>"; echo "<title>$sitename's Invite</title>"; echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheets/stylesheet.css\" media=\"handheld,screen,projection\" />"; echo "</head>"; echo "<body class=\"body\">"; echo "<div>"; /* NOW TIME FOR THE MAIN PAGE */ if (!isset($_POST['submit'])) { echo "<b>Send an invite for one of your friends to join our site:</b><br/><br/>"; echo "<form method=\"post\" action=\"secret.php\" >"; echo "Send to email:"; echo "<br/>"; echo "<input type=\"text\" name=\"email\" value=\"@\" maxlength=\"70\" />"; echo "<br/>"; echo "Your email:"; echo "<br/>"; echo "<input type=\"text\" name=\"fromemail\" value=\"@\" maxlength=\"70\" />"; echo "<br/>"; echo "Your Name:"; echo "<br/>"; echo "<input type=\"text\" name=\"from\" value=\"\" maxlength=\"70\" />"; echo "<br/>"; echo "<input type=\"submit\" value=\"Send Email\" name=\"submit\"/>"; echo "<br/><br/>"; echo "<a href=\"../index.php\">Back</a>"; echo "<br/>---<br/>$copyright"; echo "</form>"; } /* NOW TIME FOR THE CONFIRMATION PAGE */ if (isset($_POST['submit'])) { $email = htmlentities(stripslashes($_POST['email']), ENT_QUOTES, 'UTF-8'); $fromemail = htmlentities(stripslashes($_POST['fromemail']), ENT_QUOTES, 'UTF-8'); $from = htmlentities(stripslashes($_POST['from']), ENT_QUOTES, 'UTF-8'); if ($email == "" OR $fromemail == "" OR $from == "") { echo "Please fill in All fields!!<br/>---<br/>"; echo "<a href=\"secret.php\">« Back</a>"; echo "<br/>---<br/>$copyright"; } else { /* YOUR SITE AND SUBJECT INFORMATION GOES HERE! */ $site = "http://scripting.uk.to"; $subject = "Invitation"; /* AND YOUR MESSAGE INFORMATION GOES HERE */ /* HERES MY EXAMPLE INVITE */ $message = " this is not a spam email. it was sent to you from $from who's email is $fromemail they have invited you to join this site $site if you dont know the person who has sent this message or you do not wish to join please dis-regard this email ------------------------------------------ if you constantly get messages from this person/site please feel free to go to the site and let the owner know and they will make sure it is stopped and you have no further problems.. "; $headers = "From: $from <$fromemail>\n"; $headers .= "Reply-To: <$fromemail>\n\n"; mail($email,$subject,$message,$headers); echo "Thanks $from! Your message has been sent to $email!<br/>"; echo "---<br/><a href=\"secret.php\">home</a>"; echo "<br/>---<br/>$copyright"; } } echo "</div>"; echo "</body>\n"; echo "</html>\n"; ?> // // // // //im sure ill figure out my issue. but this should help you discover yours viewing a full setup.
Use this:
$headers = 'From: '.$dfemail."\r\n".
'Reply-To: '.$dfemail."\r\n" .
'X-Mailer: PHP/' . phpversion() .
'X-Priority: 1\n';
instead:
$headers = "From: $from <$fromemail>\n";
$headers .= "Reply-To: <$fromemail>\n\n";
will solve your issue.
asifnayem wrote: Use this:
$headers = 'From: '.$dfemail."\r\n". 'Reply-To: '.$dfemail."\r\n" . 'X-Mailer: PHP/' . phpversion() . 'X-Priority: 1\n';instead:
$headers = "From: $from <$fromemail>\n"; $headers .= "Reply-To: <$fromemail>\n\n";will solve your issue.
thank you, i will definetly give this a look and try. i have no idea why mine started to go to spam box once i rewrote it from my old wml script to html.
tried the modified header. but still got same result. it sends to my spam box. my email supplier is ntlworld.com (virgin media) which uses some sort of google mail system. and i just keep hitting their spam filter radar very hard.
no biggie. ill just keep looking/trying new things lol.
thanks again anyhow.
Wintch wrote: tanx man... working wella. Ghost i think the problem might be frm your provider cos mine is g0ing to inb0x nt spam.
yeah i came to the same conclusion. however i like to use things thats 100% sure. if i can. expecially when it comes to email scripts cos not many ppl at all look inside their spam boxes. usually they just deleted everything inside it in 1 hit of a button. and if my script does it with my email provider, how many other email providers will also block it.
but glad your issue is solved anyhow.
Ghost wrote: but still got same result. it sends to my spam box. my email supplier is ntlworld.com (virgin media) which uses some sort of google mail system. and i just keep hitting their spam filter radar very hard.
I assume that your email server probably blacklisted by google as spam server, try contact your service provider to change the ip. before that you could try using smtp to send email instead of mail(to make sure that youre not victim of spam server). https://support.google.com/mail/bin/answer.py?hl=en&answer=81126 you could follow the instructions.