Hi all, Can anyone tell me if there is a method of attaching bcc and cc recipients to mail messages with Flask-Mail? Cheers, Mark
Support has been added to latest tip in the repositories: http://bitbucket.org/danjac/flask-mail Just use the "bcc" and "cc" arguments when creating a message. On 30 November 2010 06:53, Mark Gemmill <mark.gemmill@gmail.com> wrote: > Hi all, > > Can anyone tell me if there is a method of attaching bcc and cc > recipients to mail messages with Flask-Mail? > > Cheers, > Mark >
Hi Dan, Thanks for the quick reply and update to repo. However, this isn't working for me. For whatever reason when it comes down to actually sending out the emails, the bcc/cc entries are not getting sent. They are there in the header, but the Lamson debug messages are only showing "rcpt TO"'s for the To addresses. I suspect that this might be the case where Lamson isn't handling the bcc/cc entries. Cheers, Mark On Tue, Nov 30, 2010 at 12:58 AM, danjac354@gmail.com <danjac354@gmail.com> wrote: > Support has been added to latest tip in the repositories: > > http://bitbucket.org/danjac/flask-mail > > Just use the "bcc" and "cc" arguments when creating a message. > > On 30 November 2010 06:53, Mark Gemmill <mark.gemmill@gmail.com> wrote: >> Hi all, >> >> Can anyone tell me if there is a method of attaching bcc and cc >> recipients to mail messages with Flask-Mail? >> >> Cheers, >> Mark >> >
That might well be the case. The lamson MailResponse __init__ parameters don't explicitly include Bcc and Cc, but they should be added to the list of whitelisted address headers if passed in the address dict (and in fact they are). I'll investigate the Lamson source further - I suspect the issue is at the Flask-Mail end rather than the Lamson end. If that brings no joy I'll raise a ticket on the Lamson mailing list. On 30 November 2010 10:41, Mark Gemmill <mark.gemmill@gmail.com> wrote: > Hi Dan, > > Thanks for the quick reply and update to repo. However, this isn't > working for me. For whatever reason when it comes down to actually > sending out the emails, the bcc/cc entries are not getting sent. They > are there in the header, but the Lamson debug messages are only > showing "rcpt TO"'s for the To addresses. > > I suspect that this might be the case where Lamson isn't handling the > bcc/cc entries. > > > Cheers, > Mark > > > > On Tue, Nov 30, 2010 at 12:58 AM, danjac354@gmail.com > <danjac354@gmail.com> wrote: >> Support has been added to latest tip in the repositories: >> >> http://bitbucket.org/danjac/flask-mail >> >> Just use the "bcc" and "cc" arguments when creating a message. >> >> On 30 November 2010 06:53, Mark Gemmill <mark.gemmill@gmail.com> wrote: >>> Hi all, >>> >>> Can anyone tell me if there is a method of attaching bcc and cc >>> recipients to mail messages with Flask-Mail? >>> >>> Cheers, >>> Mark >>> >> >
Dan, You're right, the problem isn't with Lamson. For some reason I thought you were using Lamson to send the mail as well. Trouble is with the Cc & Bcc lists not being included in the list of recipients given to the sendmail call. I entered an issue on the Bitbucket repo with a sample patch. Mark On Tue, Nov 30, 2010 at 2:52 AM, danjac354@gmail.com <danjac354@gmail.com> wrote: > That might well be the case. The lamson MailResponse __init__ > parameters don't explicitly include Bcc and Cc, but they should be > added to the list of whitelisted address headers if passed in the > address dict (and in fact they are). > > I'll investigate the Lamson source further - I suspect the issue is at > the Flask-Mail end rather than the Lamson end. If that brings no joy > I'll raise a ticket on the Lamson mailing list. > > On 30 November 2010 10:41, Mark Gemmill <mark.gemmill@gmail.com> wrote: >> Hi Dan, >> >> Thanks for the quick reply and update to repo. However, this isn't >> working for me. For whatever reason when it comes down to actually >> sending out the emails, the bcc/cc entries are not getting sent. They >> are there in the header, but the Lamson debug messages are only >> showing "rcpt TO"'s for the To addresses. >> >> I suspect that this might be the case where Lamson isn't handling the >> bcc/cc entries. >> >> >> Cheers, >> Mark >> >> >> >> On Tue, Nov 30, 2010 at 12:58 AM, danjac354@gmail.com >> <danjac354@gmail.com> wrote: >>> Support has been added to latest tip in the repositories: >>> >>> http://bitbucket.org/danjac/flask-mail >>> >>> Just use the "bcc" and "cc" arguments when creating a message. >>> >>> On 30 November 2010 06:53, Mark Gemmill <mark.gemmill@gmail.com> wrote: >>>> Hi all, >>>> >>>> Can anyone tell me if there is a method of attaching bcc and cc >>>> recipients to mail messages with Flask-Mail? >>>> >>>> Cheers, >>>> Mark >>>> >>> >> >
Thanks Mark. On 1 December 2010 08:36, Mark Gemmill <mark.gemmill@gmail.com> wrote: > Dan, > > You're right, the problem isn't with Lamson. For some reason I thought > you were using Lamson to send the mail as well. Trouble is with the > Cc & Bcc lists not being included in the list of recipients given to > the sendmail call. I entered an issue on the Bitbucket repo with a > sample patch. > > Mark > > On Tue, Nov 30, 2010 at 2:52 AM, danjac354@gmail.com > <danjac354@gmail.com> wrote: >> That might well be the case. The lamson MailResponse __init__ >> parameters don't explicitly include Bcc and Cc, but they should be >> added to the list of whitelisted address headers if passed in the >> address dict (and in fact they are). >> >> I'll investigate the Lamson source further - I suspect the issue is at >> the Flask-Mail end rather than the Lamson end. If that brings no joy >> I'll raise a ticket on the Lamson mailing list. >> >> On 30 November 2010 10:41, Mark Gemmill <mark.gemmill@gmail.com> wrote: >>> Hi Dan, >>> >>> Thanks for the quick reply and update to repo. However, this isn't >>> working for me. For whatever reason when it comes down to actually >>> sending out the emails, the bcc/cc entries are not getting sent. They >>> are there in the header, but the Lamson debug messages are only >>> showing "rcpt TO"'s for the To addresses. >>> >>> I suspect that this might be the case where Lamson isn't handling the >>> bcc/cc entries. >>> >>> >>> Cheers, >>> Mark >>> >>> >>> >>> On Tue, Nov 30, 2010 at 12:58 AM, danjac354@gmail.com >>> <danjac354@gmail.com> wrote: >>>> Support has been added to latest tip in the repositories: >>>> >>>> http://bitbucket.org/danjac/flask-mail >>>> >>>> Just use the "bcc" and "cc" arguments when creating a message. >>>> >>>> On 30 November 2010 06:53, Mark Gemmill <mark.gemmill@gmail.com> wrote: >>>>> Hi all, >>>>> >>>>> Can anyone tell me if there is a method of attaching bcc and cc >>>>> recipients to mail messages with Flask-Mail? >>>>> >>>>> Cheers, >>>>> Mark >>>>> >>>> >>> >> >
Hey Dan, have you seen the issue I reported with Gmail's SMTP server? http://bitbucket.org/danjac/flask-mail/issue/3/problem-with-gmails-smtp-server In the meantime I ended up writing a small function (not very different from the flask-mail code, but mysteriously works): import os, smtplib def send_email(recipient='', subject='', body=''): from email.MIMEMultipart import MIMEMultipart from email.MIMEText import MIMEText msg = MIMEMultipart() msg['From'] = 'Cinelista.com <%s>' % config.flask.MAIL_USERNAME msg['To'] = recipient msg['Subject'] = body msg.attach(MIMEText(body)) mail_server = smtplib.SMTP(config.flask.MAIL_SERVER, 587) mail_server.set_debuglevel(1) mail_server.ehlo() mail_server.starttls() mail_server.ehlo() mail_server.login(config.flask.MAIL_USERNAME, config.flask.MAIL_PASSWORD) mail_server.sendmail(config.flask.MAIL_USERNAME, recipient, msg.as_string()) mail_server.close() (this considers a 'config.flask' configuration object) -- Jonas
I've been having similar issues with gmail. I'll see if we can resolve the issue into a patch. Thanks for looking into this. On 30 Nov 2010 18:35, "Jonas Galvez" <jonasgalvez@gmail.com> wrote: Hey Dan, have you seen the issue I reported with Gmail's SMTP server? http://bitbucket.org/danjac/flask-mail/issue/3/problem-with-gmails-smtp-server In the meantime I ended up writing a small function (not very different from the flask-mail code, but mysteriously works): import os, smtplib def send_email(recipient='', subject='', body=''): from email.MIMEMultipart import MIMEMultipart from email.MIMEText import MIMEText msg = MIMEMultipart() msg['From'] = 'Cinelista.com <%s>' % config.flask.MAIL_USERNAME msg['To'] = recipient msg['Subject'] = body msg.attach(MIMEText(body)) mail_server = smtplib.SMTP(config.flask.MAIL_SERVER, 587) mail_server.set_debuglevel(1) mail_server.ehlo() mail_server.starttls() mail_server.ehlo() mail_server.login(config.flask.MAIL_USERNAME, config.flask.MAIL_PASSWORD) mail_server.sendmail(config.flask.MAIL_USERNAME, recipient, msg.as_string()) mail_server.close() (this considers a 'config.flask' configuration object) -- Jonas
Hi Jonas, Please see ticket on http://bitbucket.org/danjac/flask-mail/issue/3/problem-with-gmails-smtp-server for further comment. On 30 November 2010 18:39, danjac354@gmail.com <danjac354@gmail.com> wrote: > I've been having similar issues with gmail. I'll see if we can resolve the > issue into a patch. Thanks for looking into this. > > On 30 Nov 2010 18:35, "Jonas Galvez" <jonasgalvez@gmail.com> wrote: > > Hey Dan, have you seen the issue I reported with Gmail's SMTP server? > > http://bitbucket.org/danjac/flask-mail/issue/3/problem-with-gmails-smtp-server > > In the meantime I ended up writing a small function (not very > different from the flask-mail code, but mysteriously works): > > import os, smtplib > > def send_email(recipient='', subject='', body=''): > from email.MIMEMultipart import MIMEMultipart > from email.MIMEText import MIMEText > msg = MIMEMultipart() > msg['From'] = 'Cinelista.com <%s>' % config.flask.MAIL_USERNAME > msg['To'] = recipient > msg['Subject'] = body > msg.attach(MIMEText(body)) > mail_server = smtplib.SMTP(config.flask.MAIL_SERVER, 587) > mail_server.set_debuglevel(1) > mail_server.ehlo() > mail_server.starttls() > mail_server.ehlo() > mail_server.login(config.flask.MAIL_USERNAME, config.flask.MAIL_PASSWORD) > mail_server.sendmail(config.flask.MAIL_USERNAME, recipient, > msg.as_string()) > mail_server.close() > > (this considers a 'config.flask' configuration object) > > -- Jonas >