Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It looks like you're hosting your page in <a href="http://dreamhost.com" rel="nofollow">dreamhost.com</a>, a hosting provider.</p> <p>When you set up your account, they probably gave you the chance to create email accounts ending with your domain (<em>yaddayadda@addisonbean.com</em>)</p> <p>You may want to create one, get the information: host where the SMTP (the "mail server") is located, username, password... And you'll have to fill all that in your script.</p> <p>I would recommend you start testing with another regular account (Gmail.com, <strike>Hotmail</strike> Outlook.com) and that you read (quite a bit) about what an SMTP server is (which is the server you'll have to talk to in order to have your email sent)</p> <p>Here's a simple script that should send emails using a gmail account. Fill the information that is shown with asterisks with your data, see if it works:</p> <pre><code>#!/usr/bin/env python import traceback from smtplib import SMTP from email.MIMEText import MIMEText smtpHost = "smtp.gmail.com" smtpPort = 587 smtpUsername = "***@gmail.com" smtpPassword = "***" sender = "***@gmail.com" def sendEmail(to, subject, content): retval = 1 if not(hasattr(to, "__iter__")): to = [to] destination = to text_subtype = 'plain' try: msg = MIMEText(content, text_subtype) msg['Subject'] = subject msg['From'] = sender # some SMTP servers will do this automatically, not all conn = SMTP(host=smtpHost, port=smtpPort) conn.set_debuglevel(True) #conn.login(smtpUsername, smtpPassword) try: if smtpUsername is not False: conn.ehlo() if smtpPort != 25: conn.starttls() conn.ehlo() if smtpUsername and smtpPassword: conn.login(smtpUsername, smtpPassword) else: print("::sendEmail &gt; Skipping authentication information because smtpUsername: %s, smtpPassword: %s" % (smtpUsername, smtpPassword)) conn.sendmail(sender, destination, msg.as_string()) retval = 0 except Exception, e: print("::sendEmail &gt; Got %s %s. Showing traceback:\n%s" % (type(e), e, traceback.format_exc())) retval = 1 finally: conn.close() except Exception, e: print("::sendEmail &gt; Got %s %s. Showing traceback:\n%s" % (type(e), e, traceback.format_exc())) retval = 1 return retval if __name__ == "__main__": sendEmail("***@gmail.com", "Subject: Test", "This is a simple test") </code></pre> <p>Once you have the equivalent information for your domain (<em>smtpHost, smtpPort, smtpUsername...</em>) it MAY work as well (depends on the port they're using, it may be 25, which is the default for non-encrypted connections... or not... You'll have to check with <em>dreamhost.com</em> for that) </p> <p>Be aware that (since you're using a hosting that probably shares its SMTP server with other people) your "sender" may be <em>yaddayadda@addisonbean.com</em> but the actual information to connect to the <em>dreamhost.com</em> SMTP servers may be different: I'm guessing the '<code>smtpUsername</code>' may be the username you use to login in your site admin, the '<code>smtpHost</code>' may change to something like <code>smtp.dreamhost.com</code> or such... That I don't really know.</p> <p>You have a <a href="https://www.google.com/search?q=python%20smtplib%20example&amp;ie=utf-8&amp;oe=utf-8&amp;client=ubuntu&amp;channel=fs" rel="nofollow">lot of resources</a> on how to do that. </p> <p>You also seem to be a designer or photographer... One of those <strike>dudes</strike> people concern on how things look on the screen and all... Then you may wanna investigate what <a href="http://en.wikipedia.org/wiki/MIME" rel="nofollow">MiME emails</a> are. You know... so the email is not sent with text only, but you can put fancy HTML in it... <em>You know what I'm sayin'?</em></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload