help in Email title

Started on the old forum in June 2012 · view the original in the archive · old links redirect here

8 replies · 589 views · started 14 years ago · 1 min read

4 participants
Wintch Developer · 68 posts #1

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

GumSlone Administrator Principal · 1,690 posts #2

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

External image (may be gone)

Wintch Developer · 68 posts #3

gumslone tanx but i was a email variable in there and its nt working.

Ghost Senior · 366 posts #4

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.

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>
asifnayem Developer · 119 posts #5

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.

Ghost Senior · 366 posts #6

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.

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>
Wintch Developer · 68 posts #7

tanx man... working wella. Ghost i think the problem might be frm your provider cos mine is g0ing to inb0x nt spam.

Ghost Senior · 366 posts #8

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.

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>
asifnayem Developer · 119 posts #9

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.

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close