Jump to content

why does PHPmailer uses my username as from who I got the mail.


shedokan

Recommended Posts

When I send the mail it uses my gmail username as "From:".

 

phpmailer.jpg

 

here's my script:

<?php 
require("class.phpmailer.php"); 
$mailer = new PHPMailer(); 
$mailer->IsSMTP(); 
$mailer->Host = 'ssl://smtp.gmail.com:465'; 
$mailer->SMTPAuth = TRUE; 
$mailer->Username = 'name@gmail.com';  // Change this to your gmail adress 
$mailer->Password = 'pass';  // Change this to your gmail password 
$mailer->From = "test@test.com"; 
$mailer->FromName = "Test"; // This is the from name in the email, you can put anything you like here 
$mailer->Subject = "Test"; 
$mailer->Body = "
name: Test <br>
E-Mail: test@test.com <br>
<div style='width:75%;'>
<center>-----------------------------------------------------------------------------<br>
Test
<br>-------------------------------------------------------------------------------------------------</center><br>
It's just a test.
<br><center>-------------------------------------------------------------------------------------------------<br></center>
</div>
"; 
$mailer->CharSet = 'utf-8'; 
$mailer->AddAddress("name@gmail.com"); 
  if(!$mailer->Send()) 
   { 
      echo "Message Sent<br/ >"; 
      echo "Error: " . $mailer->ErrorInfo; 
   } 
?> 

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.