Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-06-2013, 01:50 AM   #1
Registered: Jun 2013
Posts: 60

Rep: Reputation: 0
Question Trying to send mail form within my python script via mailx and sendmail

i as root just installed
sendmail and mailx. i have edited the ~/.mailrc to use: [~/www/cgi-bin]# cat ~/.mailrc
account gmail {
set smtp-use-starttls
set smtp=smtp://
set smtp-auth=login
set smtp-auth-user=may)gmail
set smtp-auth-password=my_gmail_pass_not_stupid_enough_to_wite _it_again
And now i'm trying to:
cmd = "echo %s | mailx -A gmail -r %s -s %s %s" % (MESSAGE, FROM, SUBJECT, TO)
p=subprocess.Popen( cmd, shell=True, stdout=subprocess.PIPE )
output, errors = p.communicate()
print( errors, output )
Any ideas please why this fails to work?
while i remove the '-A gmail' string in the cmd line then i can send fast mail but only to mail containing the trail.
i need to be eble to send to external mails to.

Even trying it from the shell that is, 'mailx' fails to delivers my test mails.

Can one help me configure sendmail properly?

mailX == an MUA == a Mail Client right?
sendmail == MTA == program that is responsilble to send mails?

So, i gather 'mailx' does use 'sendmail' to send mail yes?

can you provide me a working mail exmaple that works?

Why i can only send mail to local server addresses an not to an external mail address?
Old 09-06-2013, 03:08 AM   #2
Registered: Jan 2009
Posts: 31

Rep: Reputation: 2
I use this from command line:

No need to configure anything. Just download it and run.
Old 09-06-2013, 03:14 AM   #3
Registered: Jun 2013
Posts: 60

Original Poster
Rep: Reputation: 0

I need to able to use SendEmail from within my python ''script.
Can it be used from there or is it form cmd only?

Please tell me a few things on how to invoke it, thank you.


mailx, python, sendmail

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to send a mail in HTML format using mailx or mail or sendmail commands vishnu_knl Linux - Newbie 8 04-05-2012 10:00 AM
Python script to web form Neruocomp Programming 1 03-24-2011 08:11 AM
How to configure sendmail only to send mail to external mail account Nivix Linux - Newbie 2 10-23-2008 12:46 AM
sendmail: how to send mail from my yahoo e-mail address harryhaller Slackware 3 11-13-2006 11:00 PM
Perl form wont send mail calmbomb Linux - Software 4 11-07-2004 10:08 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:21 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration