Package: quick-email
quick-emailQuick-and-Dirty Email SenderEmails are ubiquitous, but not super-straightforward from a programming standpoint. The standards in use (SMTP, MIME) are powerful, but complex if you want to do anything nicer than a simple plain-test email. This library was built and iterated upon for my personal projects, and it might just help you too.Supports both Python>=v2.7and>=3.4.Installationpip install quick-emailUsageSend Emailquick_email.send_email(host, port, send_from, subject[, send_to[, send_cc[, send_bcc[, plain_text[, html_text[, attachment_list[, inline_attachment_dict[, username[, password[, timeout[, require_starttls]]]]]]]]]]])My super-useful utility function. Creates and sends an email in one fell swoop. All parameters are passed to the functions below.Create Messagequick_email.build_msg(send_from, subject[, send_to[, send_cc[, send_bcc[, plain_text[, html_text[, attachment_list[, inline_attachment_dict]]]]]]])Creates aemail.message.Messagefor deferred sending or additional preparing.Email addresses can be a string (either of formexample@example.comorExample Name <example@example.com>), or a tuple, as returned byemail.utils.parseaddr.send_fromis a single email address.subjectis the Subject string of the email.send_to,send_cc, andsend_bccare all either singular email addresses, orlists of email addresses if you have multiple recipients. At least one address must be present among the parameters, otherwise anAssertionErrorwill be raised.plain_textis the plain-text part of the email.html_textis the HTML part of the email. You can include one or both, but if no text is present, anAssertionErrorwill be raised.attachment_listis an optionallistofquick_email.Attachments.inline_attachment_dictis an optionaldictofstr: quick_email.Attachmentform. The key is the CID of your attachment. In many email clients, you can include images inline in the HTML (ie<img src="...">). However, if the image you want to display is an attachment (and not at some URL), it's a little trickier. You must give your attachment a Content-ID (CID), and yourimgtag must look like<img src="cid:my_attachment_cid">. This may be preferred to the inline-base64 encoding (ie<img src="data:image/jpeg;base64,...">).class quick_email.Attachment(filename, bytes)filenameis the filename string.bytesis the bytes-like object of the content.Send Messagequick_email.send_msg(msg, host, port[, username[, password[, timeout[, require_starttls]]]])Sends aemail.message.Messageto its recipients.msgis theemail.message.Message, which you may have built usingquick_email.build_msg, or handcrafted youself.hostis the host string to connect to. Usually aFQDN, or an IP address.portis the port number to connect to. Usually25for un-encrypted email.usernameis the username of a username/password combo used to authenticate. Leave it off if your service is unauthenticated.passwordis the password of a username/password combo used to authenticate. Leave it off if your service is unauthenticated.timeoutis the timeout interval (in seconds). If not specified, the global default timeout setting will be used.require_starttlsis a flag whether to request the message sending be encrypted. Defaults toFalse, but turn it on if you can.