Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

36 lines (22 sloc) 1.227 kb
layout title
Sending mail

Sending mail


How to send mails from


web.sendmail function can be used to send mail from

web.sendmail('', '', 'subject', 'message')

If any mail server is specified in web.config it uses that to send the mail or it uses the traditional sendmail from /usr/lib/sendmail.

web.config.smtp_server = ''

To send a mail to multiple recipients, a list can be passed for to_address.

web.sendmail('', ['', ''], 'subject', 'message')

Optinal cc and bcc keyword arguments can be passed to web.sendmail to add Cc and Bcc recipients. Values of cc and bcc can be list as well.

web.sendmail('', '', 'subject', 'message', cc='', bcc='')

Addition headers can be passed to web.sendmail via headers tuple.

web.sendmail('', '', 'subject', 'message',
        cc='', bcc='',
        headers=({'User-Agent': 'webpy.sendmail', 'X-Mailer': 'webpy.sendmail',})
Jump to Line
Something went wrong with that request. Please try again.