Pranav Patel
Pranav Patel

Reputation: 1559

How can I send image in subject line in Gmail?

I'm trying to send an email and it should display subject line like below.

enter image description here

I tried to put image in subject line but it won't work.
I also googling but unable to find any solution.
Is anyone know how to do it ?
Thank you.

Upvotes: 4

Views: 5494

Answers (2)

pwilcox
pwilcox

Reputation: 5763

As you know by now, you're referencing an emoji. But I just want to share that my own experience using emojis in C# for sending gmail does not require any conversion to UTF8.

In the link provided by Webbanditten, this is presented for the sake of producing some arrows:

MailMessage message = new MailMessage(from, to);
message.Body = "This is a test email message sent by an application. ";
// Include some non-ASCII characters in body and subject.
string someArrows = new string(new char[] {'\u2190', '\u2191', '\u2192', '\u2193'});
message.Body += Environment.NewLine + someArrows;
message.BodyEncoding =  System.Text.Encoding.UTF8;
message.Subject = "test message 1" + someArrows;
message.SubjectEncoding = System.Text.Encoding.UTF8;

I don't know if its because I'm working on a .cs file that's saved as UTF-8 already, but I can just cut and paste emojis right in and don't have do deal with SubjectEncoding or with character codes.

A modified version of the code below runs successfully and both notepad and visual studio display the actual emoji in the code so it's 'readable'.

var hasIssues = true;
var emoji = hasIssues ? "😡" : "👍";

using (var client = new SmtpClient("host"))
using (var mail = new MailMessage()) {
    mail.From = new MailAddress("[email protected]");
    mail.To.Add("[email protected]);
    mail.Subject = $"{emoji} Emoji Test";
    mail.Body = "Did it go well?  Check the emoji on the subject line";
    client.Send(mail);
}

Upvotes: 1

Webbanditten
Webbanditten

Reputation: 880

That's an Emoji.

With the coolness of emoji, a new markting boom is adding emojis to the subject lines of email.

It´s not possible to add your own custom images to the subject line.

https://www.campaignmonitor.com/resources/guides/using-emojis-and-symbols-in-email-marketing/

Creating an email message using UTF-8

https://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.bodyencoding%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396

List of unicode Emojis

http://unicode.org/emoji/charts/full-emoji-list.html

Upvotes: 4

Related Questions