Friday, January 10, 2014

Installing Imapfilter

I installed Imapfilter to sort mails on the imap server (imap.domeneshop.no) I connect to into folder (The server does not support Sieve (and managesieve or sieverules plugins for Roundcube), which is an alternative that does not require a running program).

Here is how:

* Download imapfilter from github: https://github.com/lefcha/imapfilter/archive/master.zip
unzip -d imapfilter.master.zip
cd imapfilter-master/src
sudo apt-get install libssl-dev
sudo apt-get install lua5.1-dev
* Edit imapfilter.h, core.c, lua.c, pcre.c, and system.c and add lua5.1/ before lua.h, lualib.h, and lauxlib.h
sudo apt-get install libpcre3-dev
* Update Makefile to say -llua5.1 instead of -llua
make all
sudo make install



Errors I got:
auth.c:4:11: fatal error: openssl/hmac.h: No such file or directory

lua.c:5:17: fatal error: lua.h: No such file or directory
compilation terminated.
make: *** [lua.o] Error 1


pcre.c:7:18: fatal error: pcre.h: No such file or directory

cc -o imapfilter   auth.o buffer.o cert.o core.o file.o imapfilter.o list.o log.o lua.o memory.o misc.o namespace.o pcre.o regexp.o request.o response.o session.o signal.o socket.o system.o -lm -llua -lpcre -lssl -lcrypto
/usr/bin/ld: cannot find -llua
collect2: ld returned 1 exit status
make: *** [imapfilter] Error 1


All fixed by the above procedure.

Sunday, January 5, 2014

Roundcube Webmail with Domeneshop

I just set up Roundcube to fetch emails from my Domeneshop mail server and had some trouble getting it to work.
Under step 3 of the Roundcube Webmail Installer I was checking that send and receive email worked correctly and got errors. Here is the settings I used and the corresponding error I got:

Server: smtp.domeneshop.no
Port: 587


Error: SMTP send:  NOT OK(Connection failed: HELO was not accepted: )

Server: ssl://smtp.domeneshop.no
Port: 587


SMTP send:  NOT OK(Connection failed: Failed to connect socket: fsockopen(): unable to connect to ssl://smtp.domeneshop.no:587 (Unknown error))

Server: tls://smtp.domeneshop.no
Port: 587


SMTP send:  NOT OK(Connection failed: HELO was not accepted: )

I discovered, after reading through the options of main.inc.php, that you could set host for HELO. This is usually the mail servers domain (e.g. domeneshop.no) if you have an email address using your email servers domain (e.g. asmund@domeneshop.no). But, I have my email using my own domain so setting it to:

$rcmail_config['smtp_helo_host'] = 'herikstad.net';

Solved my problem. :)

Sources: http://www.domeneshop.no/faq.cgi?id=48
http://schoudhury.com/blog/articles/send-email-using-gmail-from-php-with-fsockopen/
http://stackoverflow.com/questions/13717225/email-sending-with-ci-using-hotmail
http://www.imc.org/ietf-smtp/mail-archive/msg05499.html

http://trac.roundcube.net/wiki/Howto_Config/Webservers
https://www.howtoforge.com/running-roundcube-0.7.1-on-nginx-lemp-on-debian-squeeze-ubuntu-11.10
http://mylinuxlife.com/setting-up-roundcube-webmail/