I'm trying to set up a mail server on an Amazon EC2 Micro instance - following this post by flurdy. I've installed Postfix, Courier IMAP and Squirrel Mail. I've been testing the ability to send and receive emails via postfix - and this is working fine. I've connected to SquirrelMail succesfully - however the inbox is blank.
It appears the email files are being created at /var/spool/mail/myuser
as opposed to /var/spool/mail/virtual/myuser
. At first I couldn't connect to SquirrelMail - because the myuser directory wasn't initiated within virtual/
. So I manually added this via
maildirmake myuser
The issue now is that the emails are not being stored within /var/spool/mail/virtual/myuser
directory, but still in /var/spool/mail/myuser
file.
Edit > postconf -n
alias_database = hash:/etc/postfix/aliases alias_maps = hash:/etc/postfix/aliases append_dot_mydomain = no biff = no config_directory = /etc/postfix delay_warning_time = 4h disable_vrfy_command = yes inet_interfaces = all local_recipient_maps = mailbox_size_limit = 0 maximal_backoff_time = 8000s maximal_queue_lifetime = 7d minimal_backoff_time = 1000s mydestination = $mydomain, $myhostname, localhost, localhost.localdomain mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mynetworks_style = host myorigin = mymailexample.co.uk readme_directory = no recipient_delimiter = + relayhost = smtp_helo_timeout = 60s smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) smtpd_client_restrictions = reject_rbl_client sbl.spamhaus.org, reject_rbl_client blackholes.easynet.nl, reject_rbl_client dnsbl.njabl.org smtpd_data_restrictions = reject_unauth_pipelining smtpd_delay_reject = yes smtpd_hard_error_limit = 12 smtpd_helo_required = yes smtpd_helo_restrictions = permit_mynetworks, warn_if_reject reject_non_fqdn_hostname, reject_invalid_hostname, permit smtpd_recipient_limit = 16 smtpd_recipient_restrictions = reject_unauth_pipelining, permit_mynetworks, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, permit smtpd_sender_restrictions = permit_mynetworks, warn_if_reject reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_pipelining, permit smtpd_soft_error_limit = 3 smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtpd_use_tls = yes unknown_local_recipient_reject_code = 450 virtual_alias_maps = mysql:/etc/postfix/mysql_alias.cf virtual_gid_maps = static:5000 virtual_mailbox_base = /var/spool/mail/virtual virtual_mailbox_domains = mysql:/etc/postfix/mysql_domains.cf virtual_mailbox_maps = mysql:/etc/postfix/mysql_mailbox.cf virtual_uid_maps = static:5000
Edit>
This is the result of the concat(home,'/',maildir)
from the SQL query - You can see the mail directory ends with a slash /
/var/spool/mail/virtual/myuser/
Solved> I noticed in the mail.log there was the following>
postfix/trivial-rewrite[16423]: warning: do not list domain mymailexample.co.uk in BOTH mydestination and virtual_mailbox_domains .. postfix/virtual[17251]: 149535DC7: to=, relay=virtual, delay=0.14, delays=0.12/0.01/0/0.01, dsn=2.0.0, status=sent (delivered to mailbox)
I updated /etc/postfix/main.cf
to
mydestination = mail.mymailexample.co.uk, localhost, localhost.localdomain
And it worked. Warning disappears and the logs now reveal (delivered to maildir)
.. postfix/virtual[17251]: 149535DC7: to=, relay=virtual, delay=0.14, delays=0.12/0.01/0/0.01, dsn=2.0.0, status=sent (delivered to maildir)