Gmail-proof HTML

  • Thread starter Thread starter Mark B
  • Start date Start date
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?
 
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 [ " ]
 
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\">";
 
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?
 
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?
 
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.
 
Back
Top