0

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>


      <a href="mailto:xxxxxxxey@gmail.com?subject=my report&body=Report - #id#_#pdf_id#.pdf&attachment=#pdfpath##id#_#pdf_id#.pdf">Mail</a>
Merle_the_Pearl
  • 1,391
  • 3
  • 18
  • 25
  • What is the purpose of the anchor tag in the code you posted? – Dan Bracuk Mar 21 '16 at 02:21
  • Ohh sorry - just showing I'm trying options with – Merle_the_Pearl Mar 21 '16 at 03:40
  • i don't think a different method of attaching a file to the email will solve your problem - you want to get to the root of problem; are emails being put in spam folders? are emails being rejected? is it a blacklist issue? are you on a shared server? we had a lot of problems sending emails out from shared servers where ip reputation could change regularly. in that case a dedicated ip address solved the problem. – luke Mar 21 '16 at 11:30
  • Another possible reason for people to not receive the mail is that the address is incorrect. Also, unless those people receive mail without attachments, you can't blame attachments for your problem. By the way, you should run that anchor tag, then select the link on the web page. Your question suggests that you don't know what this tag does. – Dan Bracuk Mar 21 '16 at 14:33
  • Thx Dan - addresses are correct. Email server is static IP. I'm aware of what – Merle_the_Pearl Mar 21 '16 at 15:49

2 Answers2

2

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>
WilGeno
  • 185
  • 8
0

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.

P. Furrer
  • 1
  • 1