TurnKey Linux Virtual Appliance Library

Drupal Postfix problem

First of all, thankyou to everyone who has put this appliance together!

 

Ok, I'm running a development system through virtualbox, using the network bridged adapter. Stock.

Problem is I'm not, and never have received any of the Drupal emails. Valid email address, haven't changed any settings and I've no idea where to go, even google cant help me.

I'm guessing its a problem with the postfix settings, but no idea what.

 

Anyone fancy helping?

John Carver's picture

You didn't mention which version

You didn't mention which version of the Drupal appliance you were using.  I encountered the same problem using version 11 RC.  Here is what I did to get mail flowing and Apache to quit complaining about not finding the FQDN.

1. Change the hostname in /etc/hostname and /etc/hosts.  Use the FQDN in /etc/hosts e.g.

/etc/hostname
    myserver

/etc/hosts
    127.0.1.1 myserver.mydomain    myserver

2. Add alias for root in /etc/aliases and then run newaliases.
    root:        realname@realhost

3. Change 'myhostname' in /etc/postfix/main.cf from UNKNOWN to 'localhost'.  This allows Postfix to deliver mail addressed to root@localhost.

Information is free, knowledge is acquired, but wisdom is earned.

John Carver's picture

You may also have to set relayhost

Your ISP may also require you to set Postfix's relayhost.

I just discovered that local mail to myself was working, but outbound mail to other users was stuck in the mail queue. 

Edit /etc/postfix/main.cf and change the relayhost.

    relayhost = your_ISPs_mail_server

Then restart Postfix and flush the queue.

    service postfix reload

    postqueue -f


Information is free, knowledge is acquired, but wisdom is earned.

Nikos's picture

Are these valid directions for Joomla mailout on TKL 11.1

Hi John,

I have setup a joomla development box stock TKL 11.1 

I am trying to get the email features of Joomla to work (send mail upon registration, password reminders ect) however I am not too familiar with how to setup Postfix. I see that the Webmin console gives you quite a few options but I am not too sure what to change to get emailing to work. I am not fussed at all about receiving mails - I would like to just be able to send. From what I can understand it would be best to get Postfix to relay mails to my ISP's SMTP server - however to do so my ISP requires me to login - I don't see how I would be able to do such a thing following your instructions above. Your help would be much appreciated.

 

many thanks


Alon Swartz's picture

Should work out-of-the-box

Sending of emails from Joomla should work out of the box. If you're not receiving them you might want to check your junk-mail folder. Also, take a look in the Joomla Administration Console (user system IIRC) to customize the email settings.

If you still can't get it to work, please start a new forum thread, let us know what you've tried, and also what appliance you are using (Joomla 1.5 or 1.6).

John Carver's picture

Relayhost with authentication

Hi Nikos,

There are two reasons why you might need or want to use your ISP's relayhost for sending mail.  The first is if your ISP blocks direct sending of smtp messages.  The second is if your ISP's client IP addresses (including yours) have been included in one or more spam blacklists.  All too often, the spamfighters will block an entire CIDR block after receiving spam from a single address in the block.  That is the reason I choose to send all my mail through the ISP's relayhost, or through Gmail for my Gmail accounts.  My ISP doesn't require authentication, so the config above is sufficient for me.

Alon is right in saying it should work out of the box.  I did have a problem with 11.0-RC sending mail to root, but I think that got fixed in the final release.  Haven't had time to test a virgin copy of the final version.  Unless your ISP forces you to use their relayhost, I would start testing with the out-of-the-box config, then later if you want to try using the relayhost with authentication, you can find more information at http://www.zulius.com/how-to/set-up-postfix-with-a-remote-smtp-relay-hos... The Gmail example there includes TLS authentication.  I haven't tried this myself but I would guess you will need to experiment with the port number.  The TKL appliance has both TLS and SASL installed, so you should just need to configure them and add the sasl-password file.

Good Luck

Information is free, knowledge is acquired, but wisdom is earned.

John Carver's picture

Postfix relayhost without TLS

Here is another method that may be easier to follow if you don't need TLS for security.  In either case, make sure the sasl-password file is owned by and only readable by root.

These are the basic steps to set up Postfix to use SMTP Authentication 
to send mail through a relay host.

# Set up a password maps file (/etc/postfix/sasl_passwd) as follows:

mail.ispserver.com username:password

# chown root:root /etc/postfix/sasl_passwd; chmod 600 /etc/postfix/sasl_passwd
# postmap /etc/postfix/sasl_passwd
# In /etc/postfix/main.cf:

relayhost = mail.ispserver.com
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =

# postfix reload

That should do it! 
Postfix will log into the relay host using the smtp auth username and password. 
It's possible to set different logins for different servers, by adding 
more lines to the map file. Security options must be cleared to allow 
plaintext logins.

Credit goes to www(.)freelock(.)com/kb/postfix-relayhost.  Everytime I post the link, I'm blocked by the spam blocker.  Not sure why that is.  In any case, I'm not trying to promote a spam site, but just trying to give credit to the original source of the information.

Information is free, knowledge is acquired, but wisdom is earned.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)