[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 823
  • Last Modified:

cfmail attachment problem

I am having problems with the cfmail on my page.  Currently it works sometimes and other times it doesn't.  It will sometimes send files with attachments and sometimes it will dump them to the undeliverable folder.  I have checked the attachments and the attachments are valid and the ones that do work have the same kind of attachments.

What I have noticed and works, at least for me, is when I open the .txt file in the undeliverable folder and modify the file from:

file:  (filepath)
file-type:  application/octet-stream; name=filename
file-disposition:  attachment
remove:  false

to:

file:  (filepath); file-type:  application/octet-stream; name=filename; file-disposition:  attachment; remove:  false

Save it and then add back to the spool the file sends with no problem.  If I don't make any changes and put it back into the spool the file goes back to undeliverable.

I have tried using cfmailparam instead of mimeattach but that yielded the same results.

File types that I have noticed are failing have been .doc and .pdf.  I am mainly worried about the .doc files.  I have tried specifying the type as application/msword and also leaving it application/octet-stream, both had the same result.

Is there a simple way of fixing this through code that I am just missing?
0
NeoX5
Asked:
NeoX5
1 Solution
 
srikanthmadishettiCommented:
This is important to understand when we are attaching files to emails. If we try to delete a file attachment after sending out the CFMail, chances are the mail will never get sent. The problem here is that the file doesn't actually get attached until the mail gets sent by the mail server. Therefore, if we delete a file after attaching it, we are likely deleting the file while the mail is still in the spool. Then, when the mail server goes to send out the email, it can't find the file attachment and the outgoing mail will fail.
0
 
NeoX5Author Commented:
Not sure I am following you here...

the attached file isn't getting deleted.  I can go to the directory and pull the file and it opens and exists.  The file names never change just the info, the documents get updated with new data when a job is ran but the name never changes.

When I simply add the the the semi-colon between each of the file attributes and make it one line the file sends with the attachment and no errors.  It doesn't update a file more than once during a run either....
0
 
Jones911Commented:
Perhaps post your cfmail code.
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
NeoX5Author Commented:
Here is the sample code.  I have changed it some to hide personal data but this is what is.  It will send some documents but not others and never the same ones.  If I update the code with the proper to, from and file it will send, however, when there are large amounts of email it will goto to undeliverable at time and the only way it will send from there is if I change what I said before:

.cfmail file (This works but not all the time, I pulled this from the spool and this is the same format that gets dropped to undeliverable, however, the undeliverable issue is intermittent.):

type:  text/html; charset=UTF-8
server:  #IP#
from:  fromAddress
to:  email
subject: Test
X-Mailer:  ColdFusion 8 Application Server
body:  
body:  
body: Test Document attached.
body:  
file:  filepath
file-type:  application/msword
file-disposition:  attachment
remove:  false

When it doesn't send I can change it to look like this and it will send....notice the last line.

type:  text/html; charset=UTF-8
server:  #IP#
from:  fromAddress
to:  email
subject: Test
X-Mailer:  ColdFusion 8 Application Server
body:  
body:  
body: Test Document attached.
body:  
file:  filepath; file-type:  application/msword; file-disposition:  attachment; remove:  false

With it being intermittent I am having problems pin pointing an exact cause because it isn't always the same attachments and the "fix" i have been using is working but I would like to make it work so I don't have to update the files each time.
<cfmail to="email" from="fromAddress" subject="Test" type="text/html"> <cfmailparam file="filepath" type="application/msword" disposition="attachment">
 
Test Document attached.
 
</cfmail>

Open in new window

0
 
NeoX5Author Commented:
Raising the points value some.

I am still looking into this but am still coming up with nothing.
0
 
sulzenerCommented:
Very insterested in knowing if you resolved this.  I have the exact same problem and scenerio as you so accurately described above.  Also, thanks for posting your work-a-round by adding the semi-colon.  That works for me as well.  Any additional info appreciated.  Didn't really see a solution other than your posted code.  Please adivse.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now