I don't know if this will be a distraction or a help -- this spring we sent
tons of email from registration / PyCon;

It's a bit of an older web2py, and it used t2 --- but you could see what the
pattern was like.

For example, after a Financial Aid Form was filled out, it was mailed to the
financial aid processor to review, comment:

email_fa() mails a single form from the database:

http://bazaar.launchpad.net/~yarkot1/web2conf/pycon2009site/annotate/head%3A/applications/register/models/db_fa.py

That calls t2.email(), which you'll see looks a lot like mr. freeze's
example:

http://bazaar.launchpad.net/~mdipierro/t2/main/annotate/head%3A/modules/t2.py

(search for def email_fa   and def mail)

Maybe this will be helpful...

On Tue, Jun 30, 2009 at 11:10 PM, mr.freeze <[email protected]> wrote:

>
> You might try sending an email from the Python shell using the script
> below.
> (from http://docs.python.org/library/smtplib.html) It should at least
> give you an error message if it fails.
> If you can't debug postfix before your presentation tomorrow, maybe
> you could use gmail's servers.
>
> import smtplib
> def prompt(prompt):
>    return raw_input(prompt).strip()
> fromaddr = prompt("From: ")
> toaddrs  = prompt("To: ").split()
> print "Enter message, end with ^D (Unix) or ^Z (Windows):"
> # Add the From: and To: headers at the start!
> msg = ("From: %s\r\nTo: %s\r\n\r\n"
>       % (fromaddr, ", ".join(toaddrs)))
> while 1:
>    try:
>        line = raw_input()
>    except EOFError:
>        break
>    if not line:
>        break
>    msg = msg + line
> print "Message length is " + repr(len(msg))
> server = smtplib.SMTP('localhost')
> server.set_debuglevel(1)
> server.sendmail(fromaddr, toaddrs, msg)
> server.quit()
>
>
> On Jun 30, 10:27 pm, Jason Brower <[email protected]> wrote:
> > I hope to get this resolved soon.  It was very unexpected.  It just
> > stopped working.  And now I have my thesis project being piloted for the
> > first time tomorrow. :(....
> > Is there anyone that can help?
> > Regards,
> > Jason Brower
> >
> >
> >
> > [ Attached Message ]From:Jason Brower <[email protected]>To:Web2py
> Mailing List <[email protected]>Date:Tue, 30 Jun 2009 22:01:40
> +0300Local:Tues, Jun 30 2009 2:01 pmSubject:email not workingIt looks like
> email was working, and now it's not. :(
> > I am down to static typing with still no result.
> > I have postfix installed from my ubuntu repositories.
> > I have turned off postfix and I get an error, so I figure it is getting
> > that far.
> > ---
> > def email_user(sender,message,subject, recipient):
> >     import smtplib
> >     fromaddr=sender
> >     toaddrs=recipient
> >     #msg="From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%
> > s"%(fromaddr,toaddrs,subject,message)
> >     msg="From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%
> > s"%("[email protected]","[email protected]","Testing","Another
> > test")
> >     server = smtplib.SMTP('localhost:25')
> >     server.sendmail(fromaddr, toaddrs, msg)
> >     server.quit()
> > ---
> > Any ideas?
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to