how to change setfrom in email sending by php
example I have the sender email is myemail1#gmail.com and I want change the setfrom when email is sending to myemail2#gmail.com
I tried with this code but not work
$mail->setFrom('myemail2#gmail.com', 'My Email2');
Related
I can send a email to my domain email but when using a .live email as the $to in php I get the error in the log "Denied ATTR36" is there anything I can do Thanks
I am sending email using php mailer and email is going fine to the inbox
but next time when i reply back instead of email coming to under same conversation it create a new email even it should show all the email subject
any one has an idea ?
The email you send via php must have a header
Reply-To: <from-email-address>
From: <from-email-address>
as well as a
To: <destination-email-address>
header line for it to appear as a conversation thread.
Also the subject line should be the same or be the same with a prepended 'Re: '
I am using PHPMailer to send emails, i use this code to add the email address to send to:
$mail->addAddress("receipent#domain", "receipent");
it works for one email but does not work for multiple email.
i get an error saying
You must provide at least one recipient email address.
Just use it multiple times.
$mail->addAddress('joe#example.net', 'Joe User'); // Add a recipient
$mail->addAddress('ellen#example.com');
Just call it one time for one address like
mail->addAddress("receipent1#domain", "receipent1");
mail->addAddress("receipent2#domain", "receipent2");
After filing form and submit in recieving emails, field 'from' is always default setted from parameters.ymn instead of typed in form field
$message = \Swift_Message::newInstance()->setFrom(array($Register->getEmail() => $Register->getName()))
I use gmail.
you should rather use your own email service to send emails like this, gmail overrides all from settings
How to set 'FROM' property using Swiftmailer with Gmail?
Google App-Gmail Unable to set from. Gmail replacing from address when sending via swiftmailer SMTP transport (PHP)
I have noticed that some mails come with the from address like :
Adam Mannet via www.findyourfriend.com.
What headers do I need to pass to the native PHP mail() function to accomplish this when sending e-mail?
I think the via tag is added by the mail server when somebody uses an external (from his domain) smtp server.
Per example,
my email is iceduck#iceduck.net but I send email via Gmail's smtp, you will see From iceduck#iceduck.net via Gmail.com.
If you want to make the via appear then you'll have to send your mail through the smtp server you want to appear in the via.
You can check out this link : http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm
I don't think the solution is in the header.
Best
You should check PHP mail documentation. There is a description how to modify 'From' header. You should use additional_headers to change that header information and include 'friendly name' beside your e-mail address.
<?php
// The message
$message = "Message content";
$headers = 'From: User Name <user#example.com>';
// Send
mail('test#example.com', 'My Subject', $message, $headers);
?>
This should make your from address look like: 'User Name via www.example.com'