pranshu82202 Posted August 19, 2011 Share Posted August 19, 2011 Whenever i send emails via SMTP the reciever recieved it with Name 'ROOT USER'... I want to know How to change it to my Name..... What should i do for that... And also what should i do if i want to embed an image in the message..... It would be great if you provide me some link for styling the SMTP mail... Thanx... pranshu.a.11@gmail.com Quote Link to comment Share on other sites More sharing options...
titan21 Posted August 20, 2011 Share Posted August 20, 2011 Can you advise what SMTP server you are using? Postfix? Quote Link to comment Share on other sites More sharing options...
pranshu82202 Posted August 20, 2011 Author Share Posted August 20, 2011 I am using my own smtp server mail.mydomain.com and my own email address... Can you advice how should i change the name according me.... Quote Link to comment Share on other sites More sharing options...
titan21 Posted August 20, 2011 Share Posted August 20, 2011 We need to know the software you are using for SMTP. Can you try running: [pre]netstat -tulpn | grep :80[/pre] if you see "master" in the output - this should be postfix Quote Link to comment Share on other sites More sharing options...
pranshu82202 Posted August 20, 2011 Author Share Posted August 20, 2011 i am just using a php script... HERE is the code of php script <html> <?php require("class.phpmailer.php"); // path to the PHPMailer class $to=$_POST['email']; $msg=$_POST['message']; $sub=$_POST['sub']; $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->Mailer = "smtp"; $mail->Host = "mail.mydomain.com"; $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "abc@mydomain.com"; // SMTP username $mail->Password = "password"; // SMTP password $mail->addAttachment('./apache_pb2_ani.gif'); $mail->From = "to@anydomain.com"; $mail->AddAddress("$to"); $mail->Subject = "$sub"; $mail->Body = "$msg"; $mail->WordWrap = 50; if(!$mail->Send()) { echo 'Message was not sent.'; echo 'Mailer error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent.'; } } ?> </body> </html> It is sending mesages perfectly but the problem is the name of senders (shown in the recievers mail box ) is always ROOT USER which i want to change to my name... Quote Link to comment Share on other sites More sharing options...
titan21 Posted August 20, 2011 Share Posted August 20, 2011 You can try setting the sendmail_from in php.ini or set a ini_set(). (http://uk.php.net/manual/en/function.ini-set.php) Try: ini_set("sendmail_from", "myemailaddress@mydomain.com") Quote Link to comment Share on other sites More sharing options...
pranshu82202 Posted August 20, 2011 Author Share Posted August 20, 2011 But sir i think by this we can only change our email address by which we are sending the email address.. It is not changing the name... Quote Link to comment Share on other sites More sharing options...
titan21 Posted August 20, 2011 Share Posted August 20, 2011 Okay - not familiar with the library you are using but my last suggestion would be to change this: $mail->From = "Some Nice Name <to@anydomain.com>"; Quote Link to comment Share on other sites More sharing options...
pranshu82202 Posted August 22, 2011 Author Share Posted August 22, 2011 I am using smtp to send email .. the script is working fine but when i send an email to some gmail account (or any other) the reciever recieved it withe name "ROOT USER".. How can i change this name to my name..... -pranshu.a.11@gmail.com Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted August 22, 2011 Share Posted August 22, 2011 what's the code you are using?!? Quote Link to comment Share on other sites More sharing options...
pranshu82202 Posted August 22, 2011 Author Share Posted August 22, 2011 <?php //$_SESSION['email']="pranshu.a.11@gmail.com"; //$_SESSION['fname']="pranshu"; //$_SESSION['uname']="pranshu82202"; $msg = "Hello World"; require("class.phpmailer.php"); // path to the PHPMailer class $to="abc@def.com"; $sub="Personal Mail"; $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->Mailer = "smtp"; $mail->Host = "mail.abcxyz.com"; //$mail->Port = 587; $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "xyz@mydomain.com"; // SMTP username $mail->Password = "password"; // SMTP password //$file = './abc.txt'; // attachment //$mail->addAttachment('./apache_pb2_ani.gif'); $mail->From = "xyz@mydomain.com"; $mail->AddAddress("$to"); $mail->Subject = "$sub"; $mail->Body = "$msg"; //$headers = "MIME-Version: 1.0\r\n"; //$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; //$mail->WordWrap = 50; $mail->IsHTML(true); $mail->Send(); ?> Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted August 22, 2011 Share Posted August 22, 2011 To add inforation about sender, use following functions: $mail->From="mailer@example.com"; $mail->FromName="My site's mailer"; $mail->Sender="mailer@example.com"; // indicates ReturnPath header $mail->AddReplyTo("replies@example.com", "Replies for my site"); // indicates ReplyTo headers The above was found here: http://www.ustrem.org/en/articles/send-mail-using-phpmailer-en/ Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted August 22, 2011 Share Posted August 22, 2011 Duplicate threads have been merged to this one. Don't double post. Quote Link to comment 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.