ok i finally managed to get it working... somehow msmtp seems a bit
picky, but it works as follows :
>>> p = os.popen('msmtp -t','w')
>>> p.write('To: [EMAIL PROTECTED]: testing\n\n')
>>> p.close()
thanks
claude nobs
On Mon, Jul 7, 2008 at 9:17 PM, C. Nobs <[EMAIL PROTECTED]> wrote:
> hi there
>
> i'm having a hard time sending email with msmtp from a python script....
>
> i tried the following :
>
> 1)
>
>>>> p =
>>>> subprocess.Popen(['msmtp','-t'],stdin=subprocess.PIPE,stdout=subprocess.PIPE)
>>>> p.stdin.writelines(['To: [EMAIL PROTECTED]', 'Subject: testing', '', ''])
>>>> p.stdin.close()
> msmtp: recipient address testing not accepted by the server
> msmtp: server message: 553-5.1.2 We weren't able to find the recipient
> domain. Please check
> msmtp: server message: 553-5.1.2 for any spelling errors, and make
> sure you didn't enter any
> msmtp: server message: 553-5.1.2 spaces, periods, or other punctuation
> after the recipient's
> msmtp: server message: 553 5.1.2 email address. e20sm5603566fga.1
> msmtp: could not send mail (account default from /etc/msmtprc)
>
> 2)
>
>>>> p = os.popen('msmtp -t','w')
>>>> p.writelines(['To: [EMAIL PROTECTED]', 'Subject: testing', '', ''])
>>>> p.close()
> msmtp: recipient address testing not accepted by the server
> msmtp: server message: 553-5.1.2 We weren't able to find the recipient
> domain. Please check
> msmtp: server message: 553-5.1.2 for any spelling errors, and make
> sure you didn't enter any
> msmtp: server message: 553-5.1.2 spaces, periods, or other punctuation
> after the recipient's
> msmtp: server message: 553 5.1.2 email address. d13sm9493065fka.3
> msmtp: could not send mail (account default from /etc/msmtprc)
> 16640
>
> 3)
>
>>>> p1 = subprocess.Popen(["echo","-e",'"To: [EMAIL PROTECTED]:
>>>> TESTING\n\n"'], stdout=subprocess.PIPE)
>>>> p2 = subprocess.Popen(["msmtp", "-t"], stdin=p1.stdout,
>>>> stdout=subprocess.PIPE)
>>>> output = p2.communicate()[0]
> msmtp: no recipients found
> msmtp: could not send mail (account default from /etc/msmtprc)
>
> 4)
>
> os.system("echo -e 'To: [EMAIL PROTECTED]: testing\n\n' | msmtp -t")
> msmtp: no recipients found
> msmtp: could not send mail (account default from /etc/msmtprc)
> 16640
>
> 5)
>
> p = subprocess.Popen(['msmtp','[EMAIL
> PROTECTED]'],stdin=subprocess.PIPE,stdout=subprocess.PIPE)
>>>> p.stdin.writelines(['Subject: testing', 'testing', ''])
>>>> p.stdin.close()
>>>> p.wait()
> 0
>
> while the fifth try did return without an error, i didn't receive any mail...
>
> this was tested on a stock ubuntu 8.04 server. sending an email
> manually on the terminal works as expected.
>
> thanks for any help
>
> claude nobs
>
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
msmtp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/msmtp-users