Jump to content

SMTP


pranshu82202

Recommended Posts

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

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

<?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();

?>



Link to comment
Share on other sites

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/

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.