[TriEmbed] Simplest way to send e-mail from Python? Carl?

Shane Trent shanedtrent at gmail.com
Tue May 19 13:10:42 CDT 2015


John,

Thanks for the tip about Postfix. I will give it a look!

Shane

On Tue, May 19, 2015 at 8:52 AM, John Vaughters <jvaughters04 at yahoo.com>
wrote:

> Shane,
>
> My recommendation is to load postfix and send it through gmail. Here is a
> tutorial, but there are many more tutorials showing the same type of set
> up. Postfix is now loaded by default on RedHat 7 and IMHO, far easier to
> set up than sendmail. Don't think this is the only setup option, it was
> just the first tutorial I saw, but it is pretty much the type of
> configuration I use.
>
>  https://rtcamp.com/tutorials/linux/ubuntu-postfix-gmail-smtp/
>
> Good Luck,
>
> John Vaughters
>
>
>
>   On Tuesday, May 19, 2015 12:12 AM, Carl Nobile via TriEmbed <
> triembed at triembed.org> wrote:
>
>
> Shane,
> The Ruby code is just saying it's from a gmail account. It's not actually
> sending the email through gmail. It must be using a local mail server. In
> any case the RPi is the source machine. The reason you don't need a
> password is that you are already logged into the source machine and that
> machines email account. All shell accounts are essential an email account.
> I'll try to cobble together an MTA (mail transfer agent) for you in the
> morning. It won't have all the bells and whistles in it but it should work.
> Carl
>  On May 18, 2015 6:13 PM, "Shane Trent" <shanedtrent at gmail.com> wrote:
>
> Carl,
>
> I follow about setting up a local mail server to send the outgoing mail. I
> was just trying to duplicate the function of the Ruby code snippet, which
> appears to send e-mail via Gmail without validation. The Ruby code is
> running under Mint on a VM on my desktop that I am pretty sure does not
> have a local mail server installed.
>
> I am migrating the task from Ruby/Sinatra to Python/Flask and plan to host
> it on a Raspberry Pi A+. It is actually running on the Pi now, just without
> the e-mail component. My only reservation about switching to SMS is that it
> would require a pay service as apposed to being able to do everything so
> far using free accounts.
>
> Shane
>
> On Mon, May 18, 2015 at 5:52 PM, Carl Nobile <carl.nobile at gmail.com>
> wrote:
>
> Shane,
>
> As I said in the 2nd email I sent, it looks like you just want to send an
> email to any address, correct? If so this is no big deal, but you need pop3
> setup on your local machine. If it is, then you should be good to go. Most
> emails that are not secure go to port 25 and use the SMTP protocol, they
> are sent on port 110 with the pop3 protocol, so if you are only sending
> then you only need pop3 setup. Then any simple client can be used to send
> the email.
>
> Am I understanding your issue or am I out in space somewhere?
>
> Carl
>
>
> On Mon, May 18, 2015 at 5:44 PM, Shane Trent <shanedtrent at gmail.com>
> wrote:
>
> Carl,
>
> Back in the day you could send e-mail without validating user credentials
> on the outgoing mail server. I spoofed a sender's e-mail address
> (demonstration as proof of concept) for a message going through the servers
> at Oak Ridge National Lab in the mid 90's so it was common practice back
> then. Sending without validation is the only thing that I can come up with
> to explain how or why the Ruby snippet works. But it does work. It's part
> of a project to use SMS to trigger and log events using Twilio and Gmail
> and IFTTT and Google Drive (kind of an Internet of Things: Duct-Tape
> Edition!)
>
> I would rather have a token or credential to validate for the outgoing
> mail server if validation is unavoidable. The thought of having my password
> setting in a directory in clear text gives me the heebee jeebees. I may use
> SMS for communication if I cannot figure out how to send e-mail without the
> clear text password.
>
> Thanks for chiming in! I would much prefer to start with an expert opinion
> rather than have to sort through a mountain of Google hits!
>
> Shane
>
> On Mon, May 18, 2015 at 5:30 PM, Carl Nobile <carl.nobile at gmail.com>
> wrote:
>
> Shane,
>
> The only way to not send a password in clear text is to use one of the
> secure mail transports using either port 587 or 995, both are different and
> independent of programming language. The client in Python is quite easy,
> and I have written many in the past. The Ruby code snippet would need to
> use one of the two ports above in order to be secure which can be done in
> any language. Also the receiving end must support the one you choose or you
> won't even get a connection.
>
> From the code I see above that would send everything in clear text. To not
> send a password or even use one would mean there was no password on the
> account, which I don't believe. So, I'm a little confused here as to what
> is happening.
>
> Carl
>
>
> On Mon, May 18, 2015 at 5:16 PM, Shane Trent via TriEmbed <
> triembed at triembed.org> wrote:
>
> I want to send e-mail from Python. The code below sends e-mail from Ruby
> and does not require having your e-mail password in clear text.
>
> require 'mail'
>
>     Mail.deliver do
>       from      'user at gmail.com'
>       to          'trigger at recipe.ifttt.com'
>       subject  '#1235'
>       body     "Request from: #{name}."
>     end
>
> Is there a similar way to send e-mail from Python without requiring your
> e-mail password in clear text in the code?
>
> Thanks,
> Shane
>
> --
> A blog about some of my projects.  http://fettricks.blogspot.com/
>
> _______________________________________________
> Triangle, NC Embedded Computing mailing list
> TriEmbed at triembed.org
> http://mail.triembed.org/mailman/listinfo/triembed_triembed.org
> TriEmbed web site: http://TriEmbed.org <http://triembed.org/>
>
>
>
>
> --
>
> -------------------------------------------------------------------------------
> Carl J. Nobile (Software Engineer)
> carl.nobile at gmail.com
>
> -------------------------------------------------------------------------------
>
>
>
>
> --
> A blog about some of my projects.  http://fettricks.blogspot.com/
>
>
>
>
> --
>
> -------------------------------------------------------------------------------
> Carl J. Nobile (Software Engineer)
> carl.nobile at gmail.com
>
> -------------------------------------------------------------------------------
>
>
>
>
> --
> A blog about some of my projects.  http://fettricks.blogspot.com/
>
>
> _______________________________________________
> Triangle, NC Embedded Computing mailing list
> TriEmbed at triembed.org
> http://mail.triembed.org/mailman/listinfo/triembed_triembed.org
> TriEmbed web site: http://TriEmbed.org <http://triembed.org/>
>
>
>


-- 
A blog about some of my projects.  http://fettricks.blogspot.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.triembed.org/pipermail/triembed_triembed.org/attachments/20150519/02fb6bd9/attachment.htm>


More information about the TriEmbed mailing list