Email from my VPS

Hi guys,

I now have a couple of sites setup on my Linode VPS. I have noticed I can't send email from any of them. I am running ubuntu 10 on my server.

I dont' know if and how apache needs to be configured to enable emailing.

Can anyone please help me out and tell me how to go about this, please ? :?: :?

11 Replies

How are you trying to send the email? (php/python/ruby/whatever?), do you have postfix installed?

@obs:

How are you trying to send the email? (php/python/ruby/whatever?), do you have postfix installed?

I am using PHP. I don't know if postfix is installed, how to check and how to install if necessary ….. please help the newbie :wink:

what distribution are you using? for debian/ubuntu it would be aptitude show postfix and next to state it will say State: Installed if you have it.

@obs:

what distribution are you using? for debian/ubuntu it would be aptitude show postfix and next to state it will say State: Installed if you have it.

It's ubuntu 10 and it is not installed.

I have been looking at this tutorial : http://library.linode.com/email/postfix … 0.04-lucid">http://library.linode.com/email/postfix/postfix-dovecot-mysql-ubuntu-10.04-lucid , just researching before actually getting into it.

It seems long and rather complex.

Can you direct me to a possibly simpler and shorted installation process ?

Run the following:

apt-get install postfix

Then edit /etc/postfix/main.cf to the following

# See /usr/share/postfix/main.cf.dist for a commented, more complete version

# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
myorigin = $mydomain

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = <your server="" hostname="">alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination =  localhost, localhost.$mydomain, localhost
relayhost = 
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all</your> 

You need to replace with whatever your hostname is (type hostname and press enter in the terminal to find out)

If all you need is php mail(), consider ssmtp. You'll need another mailhost somewhere that will allow you to relay through it.

it turns out all I had to do was apt-get install postfix.

I sampled the email at that point and it worked without any further intervention.

Thank you all :P

Just make sure

relayhost =

Is empty (it probably is) so people can't send spam through your server.

@obs:

Just make sure

relayhost =

Is empty (it probably is) so people can't send spam through your server.

Checked that immediately. It was empty as you suspected.

Thanks for the headsup :)

@obs:

Just make sure

relayhost =

Is empty (it probably is) so people can't send spam through your server.

The "relayhost" parameter does not stop others from using your server for relaying email. This parameter defines if email will be sent directly through the internet, or if it will user another email server to send email. See ~~[http://www.postfix.org/BASICCONFIGURATIONREADME.html#relayhost" target="blank">](http://www.postfix.org/BASIC_CONFIGURAT … #relayhost">http://www.postfix.org/BASICCONFIGURATION_README.html#relayhost](.

You can disable relaying by only allowing emails to be sent only from specific origin ip addresses. See [http://www.postfix.org/BASICCONFIGURATIONREADME.html#relayfrom" target="blank">](http://www.postfix.org/BASIC_CONFIGURAT … relay_from">http://www.postfix.org/BASICCONFIGURATIONREADME.html#relay_from]( and ~~http://www.postfix.org/postconf.5.html#mynetworks.

Whoops BiranJM's right…I shouldn't answer posts first thing in the morning.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct