PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, July 7, 2022

[FIXED] How to change envelope sender address using phpmailer?

 July 07, 2022     php, phpmailer     No comments   

Issue

With php mail() I can write

mail('to@example.com','subject!','body','From: from@example.com','-f from@example.com');

But how can I do the same with phpmailer ?


Solution

This example shows how.

the relevant lines:

$mail->SetFrom('name@yourdomain.com', 'First Last');
$mail->AddReplyTo('name@yourdomain.com', 'First Last');

As Hannes Morgenstern correctly suggested, the answer is:

$pMail->Sender='admin@yourdomain.com';
$pMail->SetFrom('name@yourdomain.com', 'First Last', FALSE);


Answered By - Theolodis
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing