top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

sendmail library using python?

+2 votes
65 views

I am looking for a python library that does mailing directly through "sendmail".

When I look into the docs, I see only an "smtlip" library but nothing that could serve with sendmail or postfix.

posted Nov 13, 2013 by Garima Jain

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

+1 vote
 
Best answer

Use the subprocess module. Pipe to:

/usr/sbin/sendmail -oi addr1 addr2 ...    
If the exit code is 0, mail dispatched.

This is a trivial function; you don't need a library for this.

Both "sendmail" and "postfix" (and "qmail" et al) provide a "sendmail" executable for exactly this purpose.

The smtplib is for making arbitrary SMTP operations, thus a whole module. Sendmail does all that for you, you only need to deliver the message to it and ensure it was accepted.

answer Nov 13, 2013 by anonymous
Similar Questions
+3 votes

How to send a mail using sendmail utility? Example would help?

+1 vote

I'm running Fedora-24(beta)/KDE, and sendmail/email (through KMail) is failing.
When I try to send email I get the warning "Failed to transmit message", and journalctl has the entry
"sendmail.service: PID file /run/sendmail.pid not readable (yet?)
after start: No such file or directory".

I've checked, and sendmail.pid is in place:

$ sudo cat /run/sendmail.pid 
2829 
/usr/sbin/sendmail -bd -q1h 

Googling for the journalctl entry, I see people have been encountering this problem for years. But I haven't seen any solution offered. Several of the comments suggest that it is a systemd problem.

please help?

+1 vote

I have a CentOS 6.4 installation running Sendmail, and after some serious hair tear stare and compare I'm a bit stumped. When I connect to the server either with telnet or SSL, sendmail is not presenting the AUTH capability after an EHLO. Everything looks like it should be working, but no amount of tweaking is getting the AUTH capability advertised (and it doesn't work if you just try it anyway).

Here's the config bits from sendmail.mc--

 define(`confAUTH_OPTIONS', `A p')dnl
 define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
 TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl

Note: Also tried

 define(`confAUTH_OPTIONS', `A')dnl
 define(`confAUTH_MECHANISMS', `LOGIN PLAIN')dnl
 TRUST_AUTH_MECH(`LOGIN PLAIN')dnl

just to keep things simple.

saslauthd is running, and configured--/etc/sysconfig/saslauthd 

 SOCKETDIR=/var/run/saslauthd
 MECH=pam
 FLAGS=

/etc/sasl2/Sendmail.conf contains--
 pwcheck_method:saslauthd

/etc/pam.d/smtp contains--
 #%PAM-1.0
 auth include password-auth
 account include password-auth

But when I do "openssl s_client -starttls smtp -connect localhost:587" I don't get any AUTH capability--

ehlo localhost
250-pennzoil.gizmopartners.com Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-DELIVERBY
250 HELP
quit

All the certs are built, and if I connect via telnet, the server does advertise STARTTLS. So anyone able to point out the obvious or not so obvious config mistakes?

0 votes

We have few rules (changeable) are stored in a database, and I need to display them for the end user in the form of flow-chart.

Is there such thing for Python?

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...