4

I use a SOCKS proxy server to send mail using sendmail in Linux and mailx to send mails from the command line.

To make use of the SOCKS server, I am using tsocks to send mails using mailx, for example like this

tsocks mailx -s "Test mail" valid_mail_address@gmail.com

But the mails I send are not going through the proxy. I don't know what I do wrong.

Any help please.

migrated from stackoverflow.com May 10 '12 at 10:39

This question came from our site for professional and enthusiast programmers.

  • Could you paste the output of tsocks mailx -v -s "Test mail" valid_mail_address@gmail.com ? That would help understand what's going on. – Frederik Deweerdt May 10 '12 at 14:24
1

I suspect mailx is configured to use sendmail so tsocks is redundant here. What happens if you omit it?

tsocks may actually be in the way - if you don't have a rule in /etc/tsocks.conf to bypass the proxy for the loopback interface it could send the message to the proxy when it shouldn't.

0

Late answer, but I just figured out how to send emails through the http/https only proxy:

Using only ssmtp and following the archlinux wiki setup. The tutorial fails at the sending of the test mail, below is the solution which works for me.

I have a ssh socks connection to localhost. I'm using corkscrew to connect to my ssh daemon running on port 443. You may or may not need this. If you don't need this omit the -o option below

ssh -vv -CND 8080 -p443 user@<sshd server> -o "ProxyCommand corkscrew 
   $proxy_ip_or_domain_name $proxy_port <sshd server> 
   443 /file/to/proxy-credentials"

the proxy-credentials authorization file looks like this:

DOMAIN\user:pass

I have configured /etc/tsocks.conf like this

server = 127.0.0.1
server_port = 8080

The tutorial command

echo test | mail -v -s "testing ssmtp setup" username@somedomain.com

hangs and doesn't work for me when putting tsocks in front of it, but

TSOCKS_CONFFILE=/etc/tsocks.conf tsocks mail username@somedomain.com 
    < .bash_history

does.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy