smtplib will return something just in case the server refuses a recipient, I guess you have to define the message-ID and send this in the mail header.
In fact, smtplib doesn't include *any* headers automatically, but just sends the text that you give it as a raw message message = 'From: [email protected]\nmessage-id:<base64>\nSubject: [PGS]: Results\n\nBlaBlaBla' I tested here, even GAE or smtplib returns a dict with invalid recipients when server refuse, when succed the dict returned is empty. I found some more info here: http://bimbo.fjfi.cvut.cz/ppolicy/browser/trunk/ppolicy/tools/smtplib.py#L605 Guess you can generate an Message-ID with random or uiid 2010/11/22 mdipierro <[email protected]> > Returning a dict evaluates as True therefore I would not consider it a > breaking of backward compatibility. Unless objections I would not make > this more complex that needs to be. Moreover I am not sure what GAE > returns for sendmail. > > Massimo > > On Nov 22, 8:41 am, Bruno Rocha <[email protected]> wrote: > > Mey be having > > > > mail.settings.returning_method = 'boolean' | 'dict' > > > > ?? > > > > 2010/11/22 mdipierro <[email protected]> > > > > > > > > > Perhaps this: > > > > > result = server.sendmail(self.settings.sender, to, > > > payload.as_string()) > > > server.quit() > > > except Exception, e: > > > logger.warn('Mail.send failure:%s' % e) > > > self.result = result > > > self.error = e > > > return False > > > self.result = result > > > self.error = None > > > return True > > > > > should be > > > > > result = server.sendmail(self.settings.sender, to, > > > payload.as_string()) > > > server.quit() > > > except Exception, e: > > > logger.warn('Mail.send failure:%s' % e) > > > self.result = result > > > self.error = e > > > return False > > > self.result = result > > > self.error = None > > > return result > > > > > Any objection to change it? > > > > > On Nov 22, 8:12 am, Bruno Rocha <[email protected]> wrote: > > > > Is there a result dictionary in Mail class, method send. > > > > > >http://code.google.com/p/web2py/source/browse/gluon/tools.py#549 > > > > > > But I dont know it this got message_id from the SMTP server. > > > > > > 2010/11/22 selecta <[email protected]> > > > > > > > If you look into the header of an email message, you will find a > key > > > > > called message-id, the value looks something like > > > > > <[email protected]> this message id is for > > > > > example used when you reply to a mail > > > > > then the header contains something like In-Reply-To: > > > > > <[email protected]> > > > > > > > I am currently working on a mailing-list plugin and for that I need > > > > > the message ids of the outgoing mails to see if incoming mails are > > > > > answers to resend incoming mails. This way I can build up a nice > > > > > treaded/tree view for all email communication. > > > > > > > Btw wouldn't it be nice to have a completely web2py based platform > for > > > > > all web2py communication ;-) > > > > > > > On Nov 22, 2:39 pm, mdipierro <[email protected]> wrote: > > > > > > What is the "message-id"? > > > > > > > > On Nov 22, 6:02 am, selecta <[email protected]> wrote: > > > > > > > > > I was wondering if there is a proper way to get the message-id > of a > > > > > > > send mail. > > > > > > > mail.send just returns true or false > > > > > > > So far I tried to send the mail also to my own account and > guess > > > from > > > > > > > comparing header and body that this is the mail that I send > out. > > > This > > > > > > > however gives me quite some headaches with all the different > > > character > > > > > > > encodings ... > > > > > > > > > Is there a better way to get the message-id of a send mail? > > > > > > -- > > > > > > Bruno Rochahttp://about.me/rochacbruno/bio > > > > -- > > > > Bruno Rochahttp://about.me/rochacbruno/bio > -- Bruno Rocha http://about.me/rochacbruno/bio

