Re: Capturing the log output of opensmtpd
Yes, a bounce message is an email, so it won't be on stdout or stderr. Either way, Martijn's answer probably points out a better approach for your case, anyways. On Sat, Oct 15, 2022 at 02:34:52PM +0100, Simon Harrison wrote: On Sat, 15 Oct 2022 14:44:01 +0200 Tassilo Philipp wrote: I guess your python subprocess is the submission agent? In that case you get the error in theory automatically, but it would be in form of a bounce message. If your submission agent cannot receive bounces they will be lost (probably hanging in the next MTA's queue for a while until they hit a timeout). On Sat, Oct 15, 2022 at 01:21:15PM +0100, Simon Harrison wrote: Hello. I'm using Python subprocess to send mails on a linux server. For outlook.com addresses I get the following error in /var/log/mail.log: Oct 14 11:41:22 myhost smtpd[1846073]: f01b467faa967988 mta delivery evpid=d9b3ae9518ff979a from= to= rcpt=<-> source="server.ip.address" relay="104.47.56.161 (104.47.56.161)" delay=2s result="PermFail" stat="550 5.7.1 Unfortunately, messages from [server.ip.address] weren't sent. Please contact your Internet service provider since part of their network is on our block list (S3140). You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors. [CO1NAM11FT072.eop-nam11.prod.protection.outlook.com]" So my question is, is there any way to get that output rather than ssh-ing into the server and checking the log? Can opensmtpd return that output as well as logging it? Python subprocess.stdout suggests that opensmtpd does not return anything over than 0 or 1. Cheers, Simon stdout and stderr are both empty strings unfortunately. Thanks, Simon
Re: Capturing the log output of opensmtpd
On Sat, 15 Oct 2022 14:44:01 +0200 Tassilo Philipp wrote: > I guess your python subprocess is the submission agent? In that case > you get the error in theory automatically, but it would be in form of > a bounce message. If your submission agent cannot receive bounces > they will be lost (probably hanging in the next MTA's queue for a > while until they hit a timeout). > > On Sat, Oct 15, 2022 at 01:21:15PM +0100, Simon Harrison wrote: > > Hello. I'm using Python subprocess to send mails on a linux server. > > For outlook.com addresses I get the following error in > > /var/log/mail.log: > > > > Oct 14 11:41:22 myhost smtpd[1846073]: f01b467faa967988 mta > > delivery evpid=d9b3ae9518ff979a from= > > to= rcpt=<-> source="server.ip.address" > > relay="104.47.56.161 (104.47.56.161)" delay=2s result="PermFail" > > stat="550 5.7.1 Unfortunately, messages from [server.ip.address] > > weren't sent. Please contact your Internet service provider since > > part of their network is on our block list (S3140). You can also > > refer your provider to > > http://mail.live.com/mail/troubleshooting.aspx#errors. > > [CO1NAM11FT072.eop-nam11.prod.protection.outlook.com]" > > > > So my question is, is there any way to get that output rather than > > ssh-ing into the server and checking the log? Can opensmtpd return > > that output as well as logging it? Python subprocess.stdout > > suggests that opensmtpd does not return anything over than 0 or 1. > > > > Cheers, > > > > Simon > > > stdout and stderr are both empty strings unfortunately. Thanks, Simon
Re: Capturing the log output of opensmtpd
On Sat, 15 Oct 2022 15:20:31 +0200 Martijn van Duren wrote: > On Sat, 2022-10-15 at 13:21 +0100, Simon Harrison wrote: > > Hello. I'm using Python subprocess to send mails on a linux server. > > For outlook.com addresses I get the following error in > > /var/log/mail.log: > > > > Oct 14 11:41:22 myhost smtpd[1846073]: f01b467faa967988 mta delivery > > evpid=d9b3ae9518ff979a from= to= > > rcpt=<-> source="server.ip.address" relay="104.47.56.161 > > (104.47.56.161)" delay=2s result="PermFail" stat="550 5.7.1 > > Unfortunately, messages from [server.ip.address] weren't sent. > > Please contact your Internet service provider since part of their > > network is on our block list (S3140). You can also refer your > > provider to http://mail.live.com/mail/troubleshooting.aspx#errors. > > [CO1NAM11FT072.eop-nam11.prod.protection.outlook.com]" > > > > So my question is, is there any way to get that output rather than > > ssh-ing into the server and checking the log? Can opensmtpd return > > that output as well as logging it? Python subprocess.stdout > > suggests that opensmtpd does not return anything over than 0 or 1. > > > > Cheers, > > > > Simon > > > It's send over syslog. So you can do whatever your syslog daemon > supports. If you use rsyslog one option could be to write it to a > named pipe: > https://www.rsyslog.com/doc/v8-stable/configuration/modules/ompipe.html > > martijn@ > Brilliant. I'll look into that. Many thanks, Simon
Re: Capturing the log output of opensmtpd
On Sat, 2022-10-15 at 13:21 +0100, Simon Harrison wrote: > Hello. I'm using Python subprocess to send mails on a linux server. For > outlook.com addresses I get the following error in /var/log/mail.log: > > Oct 14 11:41:22 myhost smtpd[1846073]: f01b467faa967988 mta delivery > evpid=d9b3ae9518ff979a from= to= > rcpt=<-> source="server.ip.address" relay="104.47.56.161 > (104.47.56.161)" delay=2s result="PermFail" stat="550 5.7.1 > Unfortunately, messages from [server.ip.address] weren't sent. Please > contact your Internet service provider since part of their network is > on our block list (S3140). You can also refer your provider to > http://mail.live.com/mail/troubleshooting.aspx#errors. > [CO1NAM11FT072.eop-nam11.prod.protection.outlook.com]" > > So my question is, is there any way to get that output rather than > ssh-ing into the server and checking the log? Can opensmtpd return that > output as well as logging it? Python subprocess.stdout suggests that > opensmtpd does not return anything over than 0 or 1. > > Cheers, > > Simon > It's send over syslog. So you can do whatever your syslog daemon supports. If you use rsyslog one option could be to write it to a named pipe: https://www.rsyslog.com/doc/v8-stable/configuration/modules/ompipe.html martijn@
Re: Capturing the log output of opensmtpd
I guess your python subprocess is the submission agent? In that case you get the error in theory automatically, but it would be in form of a bounce message. If your submission agent cannot receive bounces they will be lost (probably hanging in the next MTA's queue for a while until they hit a timeout). On Sat, Oct 15, 2022 at 01:21:15PM +0100, Simon Harrison wrote: Hello. I'm using Python subprocess to send mails on a linux server. For outlook.com addresses I get the following error in /var/log/mail.log: Oct 14 11:41:22 myhost smtpd[1846073]: f01b467faa967988 mta delivery evpid=d9b3ae9518ff979a from= to= rcpt=<-> source="server.ip.address" relay="104.47.56.161 (104.47.56.161)" delay=2s result="PermFail" stat="550 5.7.1 Unfortunately, messages from [server.ip.address] weren't sent. Please contact your Internet service provider since part of their network is on our block list (S3140). You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors. [CO1NAM11FT072.eop-nam11.prod.protection.outlook.com]" So my question is, is there any way to get that output rather than ssh-ing into the server and checking the log? Can opensmtpd return that output as well as logging it? Python subprocess.stdout suggests that opensmtpd does not return anything over than 0 or 1. Cheers, Simon
Capturing the log output of opensmtpd
Hello. I'm using Python subprocess to send mails on a linux server. For outlook.com addresses I get the following error in /var/log/mail.log: Oct 14 11:41:22 myhost smtpd[1846073]: f01b467faa967988 mta delivery evpid=d9b3ae9518ff979a from= to= rcpt=<-> source="server.ip.address" relay="104.47.56.161 (104.47.56.161)" delay=2s result="PermFail" stat="550 5.7.1 Unfortunately, messages from [server.ip.address] weren't sent. Please contact your Internet service provider since part of their network is on our block list (S3140). You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors. [CO1NAM11FT072.eop-nam11.prod.protection.outlook.com]" So my question is, is there any way to get that output rather than ssh-ing into the server and checking the log? Can opensmtpd return that output as well as logging it? Python subprocess.stdout suggests that opensmtpd does not return anything over than 0 or 1. Cheers, Simon