Gmail-proof HTML

M

Mark B

I have been using the following tags to identify a section of email HTML
when creating and sending an email with C#:

public static string MY_SECTION_DIV_START = "<DIV id='my_section_start'>";
public static string MY_SECTION_DIV_END = "<DIV id=my_section_end></div>";

So when I send an email I programmatically put these in the HTML and when I
receive an email reply to that email I search for them.

It's working fine except when emailing someone with a Gmail account. In that
case Gmail strips out the id part and returns only:

<DIV></DIV>

Does anyone know of another tag or way I could do this such that it is
Gmail-proof?
 
M

Mark B

Do you how to do that for:

public static string MY_SECTION_DIV_START = "<DIV id='my_section_start'>";

since it is already in quotes?



I have been using the following tags to identify a section of email HTML
when creating and sending an email with C#:

public static string MY_SECTION_DIV_START = "<DIV id='my_section_start'>";
public static string MY_SECTION_DIV_END = "<DIV id=my_section_end></div>";

So when I send an email I programmatically put these in the HTML and when
I
receive an email reply to that email I search for them.

It's working fine except when emailing someone with a Gmail account. In
that
case Gmail strips out the id part and returns only:

<DIV></DIV>

Does anyone know of another tag or way I could do this such that it is
Gmail-proof?

maybe the problem is that id is not "well-formed"? try to put the id's
in quotes [ " ]
 
G

Guest

Do you how to do that for:

public static string MY_SECTION_DIV_START = "<DIV id='my_section_start'>";

since it is already in quotes?


I have been using the following tags to identify a section of email HTML
when creating and sending an email with C#:
public static string MY_SECTION_DIV_START = "<DIV id='my_section_start'>";
public static string MY_SECTION_DIV_END = "<DIV id=my_section_end></div>";
So when I send an email I programmatically put these in the HTML and when
I
receive an email reply to that email I search for them.
It's working fine except when emailing someone with a Gmail account. In
that
case Gmail strips out the id part and returns only:

Does anyone know of another tag or way I could do this such that it is
Gmail-proof?

maybe the problem is that id is not "well-formed"? try to put the id's
in quotes [ " ]- Hide quoted text -

- Show quoted text -

MY_SECTION_DIV_START = @"<DIV id=""my_section_start"">";

or

MY_SECTION_DIV_START = "<DIV id=\"my_section_start\">";
 
G

Guest

Tried that just now but Gmail still stripped it.

Here's my example

<%@ Page Language="vb" runat="server" explicit="true" strict="true" %>
<%@ Import Namespace="System.Web.Mail" %>
<script language="vb" runat="server">
Sub Page_Load()

Dim objMail As New MailMessage()
objMail.From = "(e-mail address removed)"
objMail.To = "(e-mail address removed)"
objMail.Subject = "Test"
objMail.BodyFormat = MailFormat.Html
objMail.Body = "<DIV id=""my_section_start""><DIV
id=my_section_end>test</div></div>"
SmtpMail.SmtpServer = Page.Request.ServerVariables("SERVER_NAME")
SmtpMail.Send(objMail)

End Sub
</script>

This is what I get in Gmail ("Show Original")

<DIV id="my_section_start"><DIV id=my_section_end>test</div></div>

Where is the problem?
 
M

Mark B

Thanks.

I was inspecting the incoming email to my Outlook after I went into Gmail
and replied to the email I first sent Gmail.

So maybe the Gmail Reply function did the stripping.

I think I can just do the other method with the Font-Family for now since
that tested out fine.

Thanks again for your help.


Tried that just now but Gmail still stripped it.

Here's my example

<%@ Page Language="vb" runat="server" explicit="true" strict="true" %>
<%@ Import Namespace="System.Web.Mail" %>
<script language="vb" runat="server">
Sub Page_Load()

Dim objMail As New MailMessage()
objMail.From = "(e-mail address removed)"
objMail.To = "(e-mail address removed)"
objMail.Subject = "Test"
objMail.BodyFormat = MailFormat.Html
objMail.Body = "<DIV id=""my_section_start""><DIV
id=my_section_end>test</div></div>"
SmtpMail.SmtpServer = Page.Request.ServerVariables("SERVER_NAME")
SmtpMail.Send(objMail)

End Sub
</script>

This is what I get in Gmail ("Show Original")

<DIV id="my_section_start"><DIV id=my_section_end>test</div></div>

Where is the problem?
 
G

Guest

Thanks.

I was inspecting the incoming email to my Outlook after I went into Gmail
and replied to the email I first sent Gmail.

So maybe the Gmail Reply function did the stripping.

Yes, it does strip the formatting when doing a reply or forward.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,979
Messages
2,570,184
Members
46,721
Latest member
DollieSawt

Latest Threads

Top