I'm using the command:
echo "Test if email can be sent from server" | mail -s "Test" myaccount@gmail.com
This is on an Ubuntu Server 12.04 completely up to date.
To catch you up on my troubleshooting:
1) I have installed mailutils with the "Internet Site" option (or whatever that internet option was; I can't remember exactly what it was called off the top of my head).
2) I have added myself to the group 'mail'.
3) I have checked that my ISP does, in fact, block port 25. I followed these instructions using port 587, which is unblocked (I'm not sure that this has an effect on outgoing mail; it looks like a mail server to me)
4) I've also tried echo "Test if email can be sent from server" | sendmail -f myaccount@gmail.com myaccount@gmail.com
, but this also appears to do nothing.
5) I am worried that gmail is receiving on port 587, but that it doesn't know what to do with the traffic. Is this an unfounded consideration?
6) My gmail user name contains a '.' before the '@gmail.com'. Is it possible that this is confusing the mail
and sendmail
commands? (edit: after some more experimenting, this is probably not the problem)
Best Answer
SMTP servers only accept incoming mail on TCP port 25. If they accept mail from other ports such as the submission port 587, that is only for the submission of new mail from known/authenticated clients sending mail. Incoming mail from an unknown client should only be accepted on port 25.
If your ISP is blocking outgoing connections on port 25 you will need to either
Edit: the OP pointed out in a commend that Gmail allows you to authenticate and submit mail by SMTP at smtp.gmail.com on port 465 (SMTP over SSL).