Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I setup a basic email sending only server on my laptop using the following

sudo tasksel install mail-server

But for some reason I didn't get asked what kind of installation I want to do, i.e. a localhost only, internet etc etc

I used the following command to send an email from the terminal

echo 'body' | sendmail oshirowanen@gmail.com

I did not receive the email. I checked both my inbox and spam box. Plus I don't have a firewall, so no rules would have blocked the email going out. Unless of-course, ubuntu by default has a necessary port closed which is needed for sending emails out?

The mail.log is showing the following and the log is getting bigger and bigger:

Jan 16 09:21:04 ubuntu postfix/master[5923]: daemon started -- version 2.9.3, configuration /etc/postfix
Jan 16 09:21:04 ubuntu postfix/qmgr[5925]: ES8B132738: from=<oshirowanen@ubuntu>, size=233, nrcpt=1 (queue active)
Jan 16 09:21:09 ubuntu postfix/smtp[5927]: connect to gmail-smtp-in.l.google.com[2a00:1450:400c:c05::1a]:25: Network is unreachable
Jan 16 09:21:27 ubuntu dovecot: master: Dovecot v2.0.19 starting up (core dumps disabled)
Jan 16 09:21:39 ubuntu postfix/smtp[5927]: connect to gmail-smtp-in.l.google.com[173.194.67.27]:25: Connection timed out
Jan 16 09:22:09 ubuntu postfix/smtp[5927]: connect to alt1.gmail-smtp-in.l.google.com[173.194.70.26]:25: Connection timed out
Jan 16 09:22:09 ubuntu postfix/smtp[5927]: connect to alt1.gmail-smtp-in.l.google.com[2a00:1450:4001:c02::1b]:25: Network is unreachable
Jan 16 09:22:39 ubuntu postfix/smtp[5927]: connect to alt2.gmail-smtp-in.l.google.com[173.194.69.26]:25: Connection timed out
Jan 16 09:22:39 ubuntu postfix/smtp[5927]: ES8B132738: to=<oshirowanen@gmail.com>, relay=none, delay=1547, delays=1452/0.05/95/0, dsn=4.4.1, status=deferred (connect to alt2.gmail-smtp-in.l.google.com[173.194.69.26]:25: Connection timed out)

How do I stop my laptop trying to send the email, and how do I setup the mail-server properly. I just want to be able to send emails out so I can use PHP to send emails out. I do not need to receive emails in.

share|improve this question
    
Most ISPs block port 25 outgoing for connections not specifically assigned for business use or mail server use. This is to prevent spam being sent by malware on PCs. The solution is to use the ISP's relay server as relay server configured in your MTA. –  gertvdijk Feb 2 '13 at 11:30
add comment

1 Answer

First of all, you have to tell your Mail Transport Agent (MTA, in your case postfix) which sender is allowed to send e-mail, additionally you have to tell him, how you want to send it - via an Internet Service Provider, or via a company network? Even if you want to "send an email from the terminal" a mail program is doing the work (e.g. bsd-mailx).

It's essential to get some knowledge about the functions of a MTA, of mail programs and about Spam. You could start here: https://help.ubuntu.com/community/PostfixBasicSetupHowto

After you decided how you want to send your emails you could ask some more specific questions, depending if you want to build up an Internet Site, an Internet smarthost, a satellite system or a local system.

share|improve this answer
    
You also should setup your network card/gateway to clear "Network is unreachable" error. Without internet access you will never connect to gmail servers! As MTA can't connect, the email is stored in a queue (mailq command to see it), and MTA retries to send it periodically (status=deferred) –  Aurelien Jan 16 '13 at 11:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.