troubleshooting Question

Sending parameters to pythons smtplib

Avatar of midstar
midstar asked on
Email Servers
1 Comment1 Solution442 ViewsLast Modified:
I'm using the smtplib library to send emails, but I'd like to use sendmail's -L parameter so that I can assign my own tracking ID in the logs. I can't figure out how to send parameters such as this one with the smtplib library.

The smtp.sendmail() function has 4th and 5th parameters which are optional, but I'm not sure I can use them here.  In my code I have:

     smtp.sendmail(send_from, send_to, msg.as_string(),"-L12345")

but it gives me an error, "5.5.4 - parameter unrecognized".

If somebody has a solution which doesn't use the smtplib library, that's fine, but I need the ability to send attachments, and I couldn't figure out another easy way of doing this.


Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros