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

[email protected]

Link to comment
https://forums.phpfreaks.com/topic/245224-smtp/
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 = "[email protected]"; // SMTP username
$mail->Password = "password"; // SMTP password 

$mail->addAttachment('./apache_pb2_ani.gif');

$mail->From    = "[email protected]";
$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
https://forums.phpfreaks.com/topic/245224-smtp/#findComment-1259743
Share on other sites

<?php

//$_SESSION['email']="[email protected]";
//$_SESSION['fname']="pranshu";
//$_SESSION['uname']="pranshu82202";
$msg = "Hello World";

require("class.phpmailer.php"); // path to the PHPMailer class
$to="[email protected]";


$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 = "[email protected]"; // SMTP username
$mail->Password = "password"; // SMTP password 
//$file = './abc.txt'; // attachment
//$mail->addAttachment('./apache_pb2_ani.gif');

$mail->From    = "[email protected]";
$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
https://forums.phpfreaks.com/topic/245224-smtp/#findComment-1260471
Share on other sites

To add inforation about sender, use following functions:

 

$mail->From="[email protected]";

$mail->FromName="My site's mailer";

$mail->Sender="[email protected]"; // indicates ReturnPath header

$mail->AddReplyTo("[email protected]", "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
https://forums.phpfreaks.com/topic/245224-smtp/#findComment-1260494
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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