sendMailWithHeaders never returns

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is OFF
Smilies are ON
Topic review
   

Expand view Topic review: sendMailWithHeaders never returns

Re: sendMailWithHeaders never returns

Post by Jocelyn » 20 Oct 2010, 01:06

I am wondering if it is necessary to put the email send code into another thread. Sending email is just a part of my project and I don't want the whole thing to crash if something goes wrong. What approach is best?

Thanks.

Re: sendMailWithHeaders never returns

Post by erik » 18 Apr 2010, 15:36

I guess the firewall is dropping packets to "wrong" ports, but in that case there should be a timeout sooner or later. How long is "never" in your case? And where does the code actually hang? Can you provide a stack trace?

sendMailWithHeaders never returns

Post by allbabel » 03 Mar 2010, 13:43

Hi All,

I am using EDMessage to send an email in an application. It all works great until the user specifies an invalid port number. For example sending an email using smtp.gmail.com using port 465. The sendMailWithHeaders just blocks and doesn't timeout with any error. Basically the code goes like this:

EDMailAgent * mailAgent = [EDMailAgent mailAgentForRelayHostWithName:smtpServer port:port];
[mailAgent setUsesSecureConnections:ssl]; // ssl is YES
NSMutableDictionary *authInfo = [NSMutableDictionary dictionary];
[authInfo setObject:user forKey:EDSMTPUserName];
[authInfo setObject:password forKey:EDSMTPPassword];
[mailAgent setAuthInfo:authInfo];

NSMutableDictionary *headerFields = [NSMutableDictionary dictionary];
[headerFields setObject:to forKey:EDMailTo];
[headerFields setObject:user forKey:EDMailFrom];
[headerFields setObject:subject forKey:EDMailSubject];

// This blocks forever
[mailAgent sendMailWithHeaders:headerFields body:text andAttachments:attachmentList];

I have this running in a separate thread and I just want to know how I can work around this as this just blocks forever and the only way to escape is to kill the thread which isn't what I want to do. Is there a way to specify a timeout?

Thanks in advance
Andy

Top