How to use emoji in email subject line, send via PHPMailerClass - php

We are trying to send email with Emoji in subject line using our Email Api which is using PHPmailer class and powerMTA port25 for relay.
surprisingly when Email sent from our Email Api reachs yahoo and when we look into "view raw message" our subject looks like:
=?utf-8?Q?=F0=9F=91=89_Overtake_The_Year_End_Price_Drop.?=
what we sent was:
👉 Overtake The Year End Price Drop
On the other hand when look into email sent from some random ESP it's "view raw message" appears as what they had sent:
Subject: 👉Updates on Your Pre-Approved Loan offer
Please help to understand where things are getting wrong.

Set PHPMailer to use UTF-8, then go ahead and use it:
$mail->CharSet = 'utf-8';
$mail->Subject = '👉 Overtake…';

Related

Gmail telling what I am using to send email

When I send an email using phpmailer to gmail, and I look the email source, I see the following next to the "from" field:
"Using PHPMailer 6.1.7 (https://github.com/PHPMailer/PHPMailer)"
For security reasons I'd prefer to remove that if it's possible, but I don't know if this is Gmail being smart or phpmailer appending it to every email message I send.
How can I remove it?
Thanks
This appears in the X-Mailer header. As per the docs, you can remove this header altogether by setting it to a space, like this:
$mail->XMailer = ' ';
If it's appearing somewhere else, I'll need to see the rest of your code and the headers of a message you've received in gmail.

Email should come under same convestaion

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: '

Get Email To Receiver When Submitted And Also Sender Get Submission Copy using PHPMailer

I am newbie with PHPMailer library , I want to get emails from my contact form But on submission of form I want sender also get a copy of mail With additional message as " thanks for registering with us." As I gone through PHP mailer examples We can use addCC();. But how to embed additional msg.
Could you please help me with this ?
Using CC or BCC will always result in identical message being sent to all; If you want the messages to be different for different recipients, you must send separate messages with different bodies. With PHPMailer:
$mail->addAddress('recipient1#example.com');
$mail->Body = "hello abc";
$mail->send();
$mail->clearAddresses();
$mail->addAddress('recipient2#example.com');
$mail->Body = "hello xyz";
$mail->send();
It's important to call clearAddresses as otherwise the second message will be sent to both recpients.

recipient name encoding in phpmailer

Please I need a help because this problem is really killed me ...
When I send an Email with PHPMAILER using localhost on Wamp server with a non English text ,The receiver shows the Email as is (The body and subject) but TO name is shows as a numbers and hashes(symboles) , This name was got from POST[]
Now, if i write a text directly to a variable then it received as is ($variable='Arabic name';) this sends correctly(the name TO is true).
This what i got when getting the name from POST!
from:correct in any language<my#gmail.com>
reply-to: Information <info#example.com>
to: "محمد" <my#gmail.com>
I don't know why the receiver name is converted to symbols like that.
$mail->CharSet = 'UTF-8';
$mail->Encoding = "base64";
And as i mentioned above ALL Email elements(body,subject and sender name) are correct.
You can try using html_entity_decode to translate that back to a normal string.
$normalString = html_entity_decode($_POST['to']);

Zend Mail sending with headers shown in body and header section in mail clients

I am using Zend Framework to send mail.
It's doing something very odd, the content type, content dispostion, MIME version and content type encoding are all showing up in the header section (under the subject) of the email in GMail and in Outlook.
The content of the email was also being included twice in the email, once as plain text and once as HTML. I stopped this by just using setBodyText() instead of using setBodyHtml() too. I had seen somewhere that you can use both. Now I just use setBodyText() like this
$mail = new Zend_Mail('utf-8');
$mail->addTo("mail#mail.com");
$mail->setSubject("Registration info");
$mail->setFrom('do-not-reply#mail.com', "A Name");
$mail->setBodyText($this->view->render('emails/register.phtml'));
$mail->send();
This has been solved. It was an error with the host receiving the email. The fact it was in Outlook or GMail made no difference as the error was with the host.

Categories