I am having a really strange email issue here and I just can not figure out what is going on. Then I thought to myself only really smart people read my blog, why not ask them. There is a contact form on this site that collects name email and comments. This is just a simple way for visitors of the site to get in touch with me.
I originally had the email sending from my Gmail account to the same account. This raised a red flag and Gmail flagged it as spam. I ended up changing the from address to my Google Apps domain and I was now getting the email but there was still one problem. No matter where the email is coming from Gmail is stripping the body content of the email and I end up with something like this.
I thought maybe something was wrong with my code so I double checked it and quickly realized I never write bad code (joke). I changed the to address to my work email and sure enough it came through fine. In Gmail you can click on a drop down to the right and show the original which is the raw email headers and all.
As you can see the email content is there but for whatever reason Gmail does not want me to see it. Does anyone know why this is happening and how I can fix it?

#1 by Steve S on 6/11/11 - 2:53 PM
#2 by Curt Gratz on 6/11/11 - 3:08 PM
var mail = new mail();
mail.setSubject("Contact Us");
mail.setTo("toAddress@c.com");
mail.setFrom("fromAddress@c.com");
mail.addPart(type="html", body=body);
mail.send();
Curt
#3 by Peter Boughton on 6/11/11 - 3:28 PM
If so, there's two options:
Option 1: Identify where the text/plain content is coming from and remove it.
Option 2: Explicitly provide a text/plain version of the content, either in addition to, or instead of, the HTML version.
#4 by Stephen Moretti on 6/11/11 - 6:58 PM
If you have mail parts make sure you haven't specified as mime type on the cfmail tag.
#5 by Ken Hughes on 6/11/11 - 7:27 PM
#6 by Ken Hughes on 6/11/11 - 8:52 PM
Have you done a Ctrl+A on the HTML email to see if the characters are there, but are in white?
#7 by Dan Vega on 6/11/11 - 10:02 PM
@Curt - This is what my service looks like http://pastebin.com/Cd6DuLTQ
#8 by Dan Vega on 6/11/11 - 10:10 PM
#9 by Sumit Verma on 6/12/11 - 10:19 AM
For html email you should use charset=ISO-8859-1. For plain text you can use utf-8.
ALso, when using both, plain text should come before html.
#10 by Jules Gravinese on 6/12/11 - 10:32 AM
#11 by Curt Gratz on 6/13/11 - 7:33 AM
#12 by Dan G. Switzer, II on 6/13/11 - 10:31 AM
#13 by Sue G on 10/7/11 - 12:03 PM
I was doing:
mailer.setType('text');
mailer.addPart(type='text',body=emailContents);
mailer.send();
and I could see the source of the email, but it would be blank (this was in Outlook).
I just switched my code to:
mailer.setType('text');
mailer.send(body=emailContents);
and it works fine now. Maybe this can help someone else. Not sure why the former does not work when it worked back in August (for us, anyways).
#14 by Dan Vega on 10/10/11 - 12:03 PM
http://pastebin.com/knNVdLyU
#15 by Dan Vega on 10/10/11 - 12:04 PM