Centos - How to install an SMTP server, POP3 and IMAP to send email to Gmail, Yahoo, Hotmail, Live, Yandex?

1

i have a CentOS 6.4 in mediatemple.net, i need send email to Gmail, Hotmail, etc.

I tried installing postfix, sendmail, dovecot, cyrus, procmail, spamassassin, etc., and even does not work because when testing, the mail never leaves nor throws an error.

I could say as I install an SMTP server, POP3, IMAP, which can send mails to Gmail, Hotmail, Live, Yandex, Yahoo, etc..

Install:

# yum install sendmail*
# yum install cyrus*
# yum install dovecot
# yum install procmail
# yum install spamassassin

Configure Sendmail:

# nano /etc/mail/sendmail.mc

define(`confLOG_LEVEL', `20')dnl 
define(`confAUTH_OPTIONS', `A p')dnl 
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl 
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl 
define(`confCACERT_PATH', `/etc/pki/tls/certs')dnl
define(`confCACERT', `/etc/pki/tls/certs/ca-bundle.crt')dnl
define(`confSERVER_CERT', `/etc/pki/tls/certs/sendmail.pem')dnl
define(`confSERVER_KEY', `/etc/pki/tls/certs/sendmail.pem')dnl
DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl 
DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl 
DAEMON_OPTIONS(`Port=smtps, Name=TLSMTA, M=s')dnl 
dnl FEATURE(`accept_unresolvable_domains')dnl 
INPUT_MAIL_FILTER(`spamassassin', `S=unix:/var/run/spamassassin/spamass-milter.sock, F=, T=C:15m;S:4m;R:4m;E:10m')dnl 
define(`confMILTER_MACROS_CONNECT',`t, b, j, _, {daemon_name}, {if_name}, {if_addr}')dnl 
define(`confMILTER_MACROS_HELO',`s, {tls_version}, {cipher}, {cipher_bits}, {cert_subject}, {cert_issuer}')dnl

# nano /etc/mail/local-host-names
*

Configure Devcot:

# nano /etc/dovecot.conf

protocols = imap imaps pop3 pop3s 
ssl_cert_file = /etc/pki/tls/certs/sendmail.pem 
ssl_key_file = /etc/pki/tls/certs/sendmail.pem 
ssl_ca_file = /etc/pki/tls/certs/sendmail.pem 
verbose_ssl = yes


# chkconfig dovecot on

Configure SpamAssassin:

# cd /etc/mail/spamassassin
# mv local.cf local.cf.orig
# nano local.cf

required_score          5.0 
rewrite_header subject  [SPAM] 
report_safe             1 
use_bayes               1 
use_bayes_rules         1 
bayes_auto_learn        1 
skip_rbl_checks         0

# chkconfig spamassassin on
# cd /usr/src
# wget http://www.voztovoice.org/tmp/spamass-milter-0.3.1.tar.gz
# tar -xf spamass-milter-0.3.1.tar.gz
# cd spamass-milter-0.3.1
# yum install gcc ncurses ncurses-devel make gcc-c++ libtermcap libtermcap-devel zlib zlib-devel libtool
# ./configure
# make
# make install
# cd contrib
# nano spamass-milter-redhat.rc

SM_SOCKET=/var/run/spamassassin/spamass-milter.sock 
[ -x /usr/local/sbin/spamass-milter ] || exit 0 
PATH=$PATH:/usr/local/sbin

# cp spamass-milter-redhat.rc /etc/init.d/spamass-milter
# cd /etc/init.d
# chmod +x spamass-milter
# chkconfig --level 2345 spamass-milter on
# nano /etc/sysconfig/spamass-milter

SOCKET=/var/run/spamassassin/spamass-milter.sock 
EXTRA_FLAGS="-r 15"

# reboot

Logs and tests

# nano /var/log/maillog
# yum install telnet
# telnet

telnet> o localhost 25 
Trying 127.0.0.1... 
Connected to localhost.localdomain (127.0.0.1). 
Escape character is '^]'. 
220 ejemplo.org ESMTP Sendmail 8.13.8/8.13.8; Tue, 13 Oct 2009 15:20:59 GMT 
ehlo root.com 
250-example.org Hello localhost [127.0.0.1], pleased to meet you 
250-ENHANCEDSTATUSCODES 
250-PIPELINING 
250-8BITMIME 
250-SIZE 
250-DSN 
250-ETRN 
250-AUTH GSSAPI DIGEST-MD5 CRAM-MD5 
250-STARTTLS 
250-DELIVERBY 
250 HELP


quit


# spamassassin -t < /usr/share/doc/spamassassin-3.3.1/sample-nonspam.txt | grep X-Spam


X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on ejemplo.org 
X-Spam-Level: 
X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=no version=3.2.5


spamassassin -t < /usr/share/doc/spamassassin-3.3.1/sample-spam.txt | grep X-Spam


X-Spam-Flag: YES 
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on astercurso.com 
X-Spam-Level: ************************************************** 
X-Spam-Status: Yes, score=1000.0 required=5.0 tests=GTUBE,NO_RECEIVED,

Jorge Olaf Erlandsen

Posted 2013-09-03T19:57:46.453

Reputation: 191

Question was closed 2014-07-17T14:46:49.740

1Your question is not clear describe the problem in more detail – Ramhound – 2013-09-03T21:07:30.120

Answers

3

Does not work is not the best way to describe a problem, dovecot receives emails, while sendmail/postfix send emails, so you just need to install one of them, sendmail is the easier if you ask me. And if you're sending from a form chances are the problem is in your code.

If all you want is to create a contact form, then use foxyform.com. If installing a mail server is hard for you then consider using Iredmail, which is a package that contains everything.

To install sendmail just

yum install sendmail

And that should do it, the problems is more likely to be in your code, please give more details

Lynob

Posted 2013-09-03T19:57:46.453

Reputation: 3 254

does not work because when testing, the mail never leaves nor throws an error. – Jorge Olaf Erlandsen – 2013-09-03T20:11:35.697

1@OlafErlandsen Are you sending from a form? if so please provide a code? and right now what are mail server are you using? did you uninstall the other mail servers you tried to install? – Lynob – 2013-09-03T20:15:31.187

no... i use cli... show my update – Jorge Olaf Erlandsen – 2013-09-03T20:33:24.633

@OlafErlandsen why the hell you need cyrus dovecot, sendmail, procmail and cyrus all together! you know what they are? look just uninstall everything, if you could format the server it's better and just install iredmail, follow this tutorial on rackspace http://www.rackspace.com/knowledge_center/article/centosrel-iredmail-installation if you face any problem, read the comments first

– Lynob – 2013-09-03T21:06:13.687