ColdFusion CFMail wont send HTML - email

I have a weird problem and its got me stumped. If I send an email like this (below) it sends fine. The content of the email is html and sending using the first method shows the html content as text as expected.
<cfmail to="xxxx.xxxx#xxxx.com" from="xxxx.xxxx#xxxx.com" subject="To Oxint">
I change nothing in the email except change the cfmail line to this (below)
<cfmail to="xxxx.xxxx#oxint.com" from="xxxx.xxxx#xxxx.com" subject="To Oxint" type="html">
The email is not received. Not in my junk or spam folder. Just not received. CF mail logs show my email as successfully sent.
I've got our network team looking for issues as well, but its baffling. Any suggestions would be very much appreciated.

Some e-mail clients deny HTML mails without a plain part. Try this:
<cfmail from="someone#somewhere.com" to="someone#somewhereelse.com" subject="always deliver e-mails in plain as well">
<cfmailpart type="text/plain">Here is some text.</cfmailpart>
<cfmailpart type="text/html">Here is some <b>bold</b> text.</cfmailpart>
</cfmail>
Order matters here. First text/plain, then text/html.

Related

Content-type issue for email attachments mule

I'm using Mule's IMAP connector to read email attachments. I pretty much follow this. It all works fine, but my problem is that there are couple of end users who now tend to send the emails with attachments to us, but with Content-type as 'text/csv' or 'application/octet-stream' in which case Mule is unable to recognise/parse the attachments. The email client like outlook has no problems downloading the files. But does not work with Mule code - probably, the content-type to be blamed but is there a way I can get over this without demanding a change from the end user?
Here is the code that reads the attachments:
<expression-transformer doc:name="Read Attachments and set them as payload"
name="returnAttachments">
<return-argument evaluator="attachments-list"
expression="*" />
</expression-transformer>
<imaps:inbound-endpoint host="${email.server.host}"
port="${email.port}" responseTimeout="10000"
doc:name="IMAP" connector-ref="IMAPS" password="${email.pwd}"
transformer-refs="returnAttachments" user="${email.user}"
disableTransportTransformer="true" />
<!-- The code below does not work when the emails arrived have content type other the "multipart/mixed"-->
<set-variable variableName="fileName" value="#[groovy:payload.name]"
doc:name="fileName" />
As mentioned this one recognises the email and attachments when the content type(header) of the email is "mutipart/mixed". Does not work otherwise. Should I be asking the client to set the content type ?
Your question does not explain what exactly you're trying to do. You can send anything through e-mail. Each attachment is marked with a corresponding MIME type to indicate what sort of data format it contains -- is that an image, or a ZIP file, or perhaps a PDF document?
What is your application doing, and what reaction do you expect when I send, say, a holiday picture as an attachment? What should it do if I attach my bank's statement?
These questoins are about the business logic, about the real purpose of your project. This question does not contain any data about that, unfortunately.

Attachments - Mailto and CFMail and Mail Servers

Trying to sort out some best options for emailing attachments and getting them to the destination needed.
The CFMail coding below works fine (goes to gmails and hotmails for sure) - but sometimes users relate that they don't get the email - this strikes me as an email validation problem on the server or spam folder issue. But with the server - server is setup properly I believe - and not on any BlackLists I know of.
I looked into the < a href = "mailto: with an attachment - but no go with that - and as I read - becomes perhaps a bigger security issue.
Does anyone have any advice - how I could best attach a file to email - and avoid the users not getting it etc... Thx for any help or suggestions.
<cfset pdfpath = expandpath('./_pdf/')>
<cfmail type="html" from="noreply#xxxxxxxxx.com" to="#tlist#" mimeattach="#pdfpath##id#_#pdf_id#.pdf" subject="Report - #id#_#pdf_id#.pdf">
</cfmail>
Mail
Here is a blog post I wrote on sending email and helping make sure it passes SPAM filters and as a bonus the blog posts contains info on sending attachments. http://www.trunkful.com/index.cfm/2010/5/27/How-to-CFMAIL-Properly-and-Keep-the-SPAM-in-the-Can My posts include all the code examples to help you resolve this. The end result would look something like this.
<cfmail to="to#address.com" from="from#address.com" subject="Some Subject" type="html">
<cfmailparam file="/document/path/mypdf.pdf" disposition="attachment" type="application/PDF">
<cfmailpart type="text/plain" charset="utf-8">#textmessage(mailmessage)#</cfmailpart>
<cfmailpart type="text/html" charset="utf-8">#mailmessage#</cfmailpart>
</cfmail>
Maybe you should also check the valid SPF record of the shipping Domain(from="noreply#xxxx.com") > http://www.openspf.org/SPF_Record_Syntax. Many spam filters use SPF checks.

Urls with special characters are not converted correctly by SendGrid

I have a url in one of my emails for twitter share that looks like:
http://twitter.com/share?text=Praneeta%27s%20test&url=http%3A%2F%2Fwww.mydomain.com%3Fparam1%3D303%26param2%3Dtest&related=praneeta&via=Praneeta
However SendGrid converts only the part before the ' (encoded as %27)
So the url I have in the emails sent is broken and looks like
http://email.mydomain.com/wf/click?upn=<long_encoded_key>%27s%27s%20test&url=http%3A%2F%2Fwww.mydomain.com%3Fparam1%3D303%26param2%3Dtest&related=praneeta&via=Praneeta
Is there a work around for this?
note: If I copy the email html and send it to myself via putsmail, it works fine, it breaks only when it goes via Sendgrid.
I just sent the link you posted through my own SendGrid account and it looks like it was properly encoded. I wonder if this was a temporary issue? What happens if you try sending that link again?
Just a heads up on this issue incase if people stumble on this. The method should be escape for example:
CGI::escape('\'')

Emails sent through joomla go to SPAM folder

I am using the latest Joomla build for my website.
Allso we use a DNS record for having the mail delivered to our own server instead of the server on which the website is hosted.
I have used several contact form components, but every sent mail goes to my SPAM folder.
After searching hours on the web (and getting linked to this site frequently) i decided to make a new post.
It does not matter if i use the standard joomla forms, or any component.
Whenever a user fills in a form on my website, the email gets sent. The user receives a copy of its message, and i receive the message of the user. However, this message gets thrown in the spam folder, as phishing.
The sender of the mail always is: username#nameserver.i3d.net; namens; websitename
What do i have to change/enable/disable for this to work?
Thanks in advance.
Patrick.
(Sorry, I'm new to Joomla, but it uses PHP, so this may apply. Also this answer got a little long...)
It might be an issue with the email headers. A lot of email clients will automatically spam-box all mail where the address in the From: header doesn't match the envelope sender. As an analogy, you might not trust a snail-mail letter signed "Your Rich Uncle", mailed in an envelope with a Nigerian return address. Also if your envelope sender has a different domain than the one the email is actually sent from, that's another quick ticket to the junk bin. For more info about Gmail's message blocking policies (and general good practices), you can try this help page.
Here's some basic PHP email-sending code:
$to = $userEmailAddress;
$subj = $emailSubject;
$mesg = $emailMessage;
$headers = implode("\r\n",array(
"MIME-Version: 1.0"
,"Content-type: text/html;charset=iso-8859-1"
,"From: WEB_ADMIN_NICE_NAME <WEB_ADMIN#YOURSERVER.COM>" // *** 'From:' header
));
$from = "-fWEB_ADMIN#YOURSERVER.COM"; // *** envelope sender
if(!mail($to, $subj, $text, $headers, $from)){
//Some error handling...
}
On the first line I commented, you'll want to replace WEB_ADMIN_NICE_NAME with the name you want the email recipient to see (e.g. "Bill Gates"), and on both lines, replace WEB_ADMIN#YOURSERVER.COM with the actual return address (e.g. "da_boss#microsoft.com"). Note: whatever address you choose for the return address is where users' replies will be sent.
To reiterate, make sure both lines have the same return address (though the nice name can be anything you like), and make sure that the actual server sending the mail is in fact located at YOURSERVER.COM.
Lastly, I'm not sure where Joomla does its mailing, but if you're totally lost, you can try grepping with -lr for 'mail[[:space:]]*('.
there are several reasons that could make your email look suspicious to spam filters; to find out which head on to:
http://www.mail-tester.com
grab the email address and send an email from your website to it.
Then go back to the page and it will tell you what's wrong.
btw I'm struggling with the same issue,my problem being that on Joomla 2.5.9 apparently when you send html emails, a text-only copy is not added to the message, which is considered "spammish behaviour"
The problem is the i3d.net email address. My personal experience is that their network (31.204.154.0 - 31.204.155.255) is a significant source of spam and they do not action abuse reports. I suggest changing your hosting company.

How to get the received email with spaces in CAKEPHP?

In my cakephp website i have a controller which handles a simple contact form. But i have a problem! If in the contact_controller.php code i use:
$this->Email->send($this->data['Contact']['message']);
i receive the email in my mail box with linebreaks like the user wrote the message. But if i use:
$this->Email->send();
and create an html template to get the variables that i want to receive in mail, i will receive the same with no linebreaks.
How i can fix that?
Which one do you want? In the first case you send a plain text email, so you will have your line breaks in place.
In the second place you send HTML e-mail, where line breaks are in place, but simply ignored.
So either keep sending mails plain text or use nl2br() function on the body for html output.