Posted on Leave a comment

Getting “push email” without an Exchange server

For some people, getting their email pushed to their mobile is important. Although the emails from my home email server is not really as important as my work emails, it still is a good learning experience and its fun. 😀

First, one must already have a working email server. I  am not going to discuss that here. My personal setup is a Debian unstable box with Postfix and Dovecot. I set up my imap server with Maildir and virtual users.

Next, if you use a Debian based distro, do not use “d-push” ,the Debian packaged version of Z-Push, because it is old and I ran into a lot of problems getting it to work. Just download the upstream version and you should be fine.

Unpack the downloaded file and follow the “INSTALL” file instructions.

There are 2 config.php file that we have to edit. The main one on the root of the install, we need to add the “BACKEND_PROVIDER”. Since I am using imap, I added “BackendIMAP”.

Screen Shot 2015-03-07 at 11.32.10 AM

 

 

 

The second config.php file is under the backend/imap folder.  I change the port because I am using SSL. The options part I had to do a lot of trial and error, and some research.(5)

Screen Shot 2015-03-07 at 11.30.00 AM

 

 

 

Save both of this files and reload your Apache.  Before setting up your device try to login through the browser. One should get something similar to this screenshot. If not, you need to do more troubleshooting.

Screen Shot 2015-03-07 at 11.59.07 AM

 

 

 

 

References

  1. http://php.net/manual/en/function.imap-open.php
  2. http://z-push.org/
  3. http://z-push.sourceforge.net/phpbb/viewtopic.php?f=2&t=2408&p=8788&hilit=dovecot#p8788
  4. http://doc.zarafa.com/7.0/Administrator_Manual/en-US/html/_zpush.html
  5. https://nickebo.net/setting-up-push-mail-with-dovecot/
Posted on Leave a comment

Making a Blackberry out of my Nokia N95

I finally found a working solution to the problem of getting all my email accounts in one single place and also getting it “pushed” to my cellphone. I will give you all the steps but YMMV. Basically,what we need is to setup a mail server.

  1. I have a yahoo ,a gmail and my ISP email(comcast). I have to somehow fetch all the mail from these services to my server. Yahoo however sucks coz you have to pay to get access to your email via the POP protocol so what I did is just forward all my mails to my other accounts ,I chose gmail. Fetching Gmail and Comcast using fetchmail is pretty straightforward , so I’ll leave that to another post.
  2. Install a mail server. I already have MTA ,which is Postfix which I already got working for local delivery so All I need left is a POP/IMAP server. For these,I tried Cyrus,courier and Dovecot,stay away from Cyrus ,SASL is a PITA to setup..I am using Dovecot,much much simpler to setup and well documented configs.
  3. Make sure if you have a firewall that you open up the right ports for imap,imaps,pop,smtp .Also don’t forget the server itself coz sometimes there are firewalls installed like fail2ban and moblock.
  4. I use Imap on my N95 coz it’s much simpler to manage and you also get the “push email” functionality like that of the Blackberry. Just go to messaging and enter your server details . And one very important thing I noticed, Most of the time when accessing your mail It would like it gets stuck in “Updating Mailbox ” but actually it is synchronizing the folders . So have “PATIENCE”. If it really takes a while try to trim down the folders that one is subscribing to and try again.

Here are my configs.

My dovecot.conf:

protocols = imap imaps managesieve
disable_plaintext_auth = yes
shutdown_clients = yes
log_timestamp = "%Y-%m-%d %H:%M:%S "
ssl = yes
ssl_cert_file = /etc/ssl/ca/certs/dovecot.pem
ssl_key_file = /etc/ssl/ca/private/dovecot.pem
mail_location = maildir:~/Maildir
namespace private {
separator = .
prefix = INBOX.
inbox = yes
}
mail_privileged_group = mail
protocol imap {
mail_executable = /usr/lib/dovecot/rawlog /usr/lib/dovecot/imap
imap_idle_notify_interval = 120
imap_client_workarounds = delay-newmail netscape-eoh outlook-idle
}
protocol managesieve {
}
protocol lda {
auth_socket_path = /var/run/dovecot/auth-master
postmaster_address = root@localhost
mail_plugins = sieve
global_script_path = /home/vmail/globalsieverc
}
auth default {
mechanisms = plain login
passdb pam {
args = blocking=yes
}
userdb passwd {
args = blocking=yes
}
user = root
socket listen {
master {
path = /var/run/dovecot/auth-master
mode = 0600
}
client {
path = /var/spool/postfix/private/auth
mode = 0660
user = postfix
group = postfix
}
}
}
dict {
}
plugin {
sieve=~/.dovecot.sieve
}

My postfix main.cf:

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
append_dot_mydomain = no
readme_directory = no
smtpd_tls_security_level = may
smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom
smtpd_tls_received_header = yes
smtpd_tls_cert_file = /etc/ssl/ca/certs/postfix.pem
smtpd_tls_key_file = /etc/ssl/ca/private/postfix.pem
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_tls_loglevel = 1
myhostname = devsphoto.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname , localhost, localhost.localdomain
relayhost = [smtp.comcast.net]:587
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.1.0/24
mailbox_command = /usr/lib/dovecot/deliver
mailbox_size_limit = 0
home_mailbox = Maildir/
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4
transport_maps = hash:/etc/postfix/transport
smtp_generic_maps = hash:/etc/postfix/generic
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
local_recipient_maps =
smtpd_tls_auth_only = no
receive_override_options = no_address_mappings
content_filter = smtp-amavis:[127.0.0.1]:10024

Posted on Leave a comment

Postfix,comcast and WordPress

I ran into problems with creating user accounts with my WordPress install.

WordPress uses Postfix to send email to my ISP which is Comcast.The problem is it sends it as sender www-data@localhost. I have to google for the right solution for this. The Postfix package in Debian doesn’t have enough Documentation so I have to the online Documentation.

Manpages is only helpful if you know what you are looking for. So ,thanks to google I was able to get this http://www.postfix.org/ADDRESS_REWRITING_README.html#generic

Basically,what it does is rewrite the sender address to my regular comcast address.Cool!