0

I have a form that is sending 4 separate emails when it is processed all of which contain up to 4 attached PDF/Word documents. The way I have it setup is that I have spoolenable="false" on every email so that they are sent immediately. Then, on the last email I also have remove="true" so that the attachments are deleted from my server. The problem that I'm having is that only 2 of the 4 emails are being sent before I get a:

java.net.SocketTimeoutException: Read timed out.

Not really sure what I can do to fix this but I'm willing to try any suggestions.

Thanks

dukedevil294
  • 1,285
  • 17
  • 31
  • This seems like a server issue more than a Java issue. When your form runs, is there a long period of time between opening the socket and sending data? Most servers only keep sockets alive for so long before closing them if there's no data being sent across. You may want to see if there's any options you can set to keep the connection alive longer. – Shrike Aug 22 '13 at 18:08

1 Answers1

1

This would be a poor use of spoolenable="false". What that setting does is set the email to send immediately bypassing the built in mail spooler. This makes the client request have to wait to return till the email is sent. This impacts the users of the system as they now have to wait for the CF server to actually send the email. This now adds a potential point of failure to the client request and could cause other issues.

If you want to avoid the spool I would do the mail send in a cfthread. This way you are at least not impacting the client with the mail send.

Dave Ferguson
  • 743
  • 3
  • 10
  • Well the reason I set spoolenable to false is because my email attachments are being attached to 4 different emails and so they cannot be deleted until all of them have processed. If I let the emails be spooled and delete the attachments using remove="true" on the last email or delete them with cffile they are sometimes deleted before the email is actually sent. Will sending them in a cfthread fix this problem? – dukedevil294 Aug 22 '13 at 20:02
  • Perhaps I could let the emails spool and then schedule a task that goes in every night and empties that folder. I think that is probably the best way to compromise on both ideas. – dukedevil294 Aug 22 '13 at 20:22
  • 1
    If the file deletion is your concern you should handle the file differently. I would temporarily store them somewhere and then have a process that deletes them later. Then you can still spool the email and not impact the user. – Dave Ferguson Aug 22 '13 at 20:44
  • I agree with dave. I think design wise you should only use "remove" when you have a single attach and send operation. Otherwise you have issues like this - including some times file handles and locks that are hard to disengage. – Mark A Kruger Aug 23 '13 at 13:14