~ overflow ~

Tag: pop3

Testing email server with telnet

by z3n on Apr.28, 2009, under Tips & Hints

I keep forgeting about this so i decided to write a post.

Problem:

An easy way to test a pop3 email server.

Solution:

telnet mail.server.com 110

user username

pass yourpassword

list to list messages

stat to show status of your mailbox

retr # to show the message

dele # to delete a message

Source:

Mike Tech

Leave a Comment :, , , , more...

Configure Sendmail on Linux – Full Guide

by admin on Jul.18, 2008, under Linux Happyness, Tips & Hints

Configuring sendmail could be a real nightmare, not only because it depends on what linux distro you’re using but because there are many different terms that comes up when you do a search, so i’m keeping it simple. Before anything i’m configuring sendmail as MTA on a machine with fedora, i will be using dovecot to transfer the emails over pop3, so first all you gotta install this stuff on your machine, by using yum:

yum install dovecot sendmail system-switch-mail

to make sure you’re using sendmail as your MTA, run system-switch-mail and set it as the MTA, about dovecot, you need to start it by service dovecot start – i forgot if there’s any relevant configuration that you need to change on it, but i don’t think so.

after that you need to configure your hostname,

hostname yourhappyhostname.com

and edit the file /etc/sysconfig/network and change the hostname there too,
now we’re going to edit sendmail config file, at /etc/mail/sendmail.mc

enable this:

FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_DOMAIN(localhost)dnl
MASQUERADE_DOMAIN(localhost.localdomain)dnl

* if you want more info about configuring and masquerading stuff on sendmail, search for man sendmail

and for EACH domain you want to have emails into, add those weird lines on the same sendmail.mc file:

Cwyourdomain.com
Cwmail.yourdomain.com

note that it’s Cwyourdomain.com and Cwmail.yourdomain.com — ALSO note, that you need to ask your DNS provider, probably your host, to add the mx record for you, it should be:

domain.com. IN MX 10 mail.domain.com.

you can’t do that unless you run the DNS server, there are some hosts that set it automatically, to know if your mx record is right, you should do this command on shell:

dig domain.com mx +noall +answer

so continuing configuring sendmail, after saving the file, you need to compile it, by this command:

m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

after that we need to do a new user for the email (no you can’t use your email as root you stupid!) to do that so you need to have root access to the server, you add a new user :

useradd -d /path/to/user/home/dir username;passwd username

this will add and prompt for the new user password, and then you can add aliases for that user at /etc/aliases wich could help you to address multiple emails with the same name, like webmaster@site1.com , webmaster@dumbfuck.com, webmaster@yomama.com and so on, basically you will put this:

alias: user,user2,userx

where alias is the email name, in that example it would be webmaster: site1,dumbfuck,yomama (if the users were site1, dumbfuck and yomama). Now that you’re done with the aliases, you need to update them on the system by:

newaliases

Now, you need to setup the emails in here: /etc/mail/virtusertable this is very simple, you just add the email you want and the username for example:

webmaster@site1.com site1
webmaster@dumbfuck.com dumbfuck
webmaster@yomama.com yomama
@idiotic.com idiotic

note that the last entry has nothing before @, wich means that anything@idiotic.com will fall into the same login, wich is very helpfull when only you own the domain and stupid people can’t type your username right. After editing this file you need to update the .db one by:

makemap hash /etc/mail/virtusertable.db < /etc/mail/virtusertable

and THEN… THEN!!!! you restart sendmail by:

service sendmail restart

now you’re ready, you can put on your happy email client the user login and password you did with useradd and as server you will use mail.yourdomain.com (this depends on your mx record, set by your host as explained).

you can even build a little .sh script to setup emails quickly for you, the commands you will need to give are the following:


useradd -d /home $1;passwd $1;
vi /etc/mail/sendmail.mc;m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf;
vi /etc/aliases;newaliases;vi /etc/mail/virtusertable;makemap hash /etc/mail/virtusertable.db < /etc/mail/virtusertable;service sendmail restart;

and that’s it (not really a full .sh script cuz i’m tired of you) – so that’s how you configure a mail server WITHOUT Exim or CPanel gayness, all hail the holy bash!

Note: After configuring the emails you need to setup a Reverse DNS, due the spam, some big servers, like yahoo, do a reverse dns check to know if your server is really a server or just some spammy script kid, to know if your server has a reverse DNS working, give a:

nslookup 1.1.1.1

where 1.1.1.1 is obviously your server ip — don’t use a domain or it will not work — if you get an error here you will need to setup a reverse dns by named or contact your host to set it for you – it’s best contact your host first so you don’t loose time configuing named for nothing.

Usefull links:
http://cbl.abuseat.org/lookup.cgi – a place to know if your server is black listed due misconfig or malusage and how to remove it
http://www.linuxselfhelp.com/quick/sendmail.html – the only relevant page on the many searchs i did on this.
http://www.linuxmail.info/ – a spammy site with a little usefull info about mail servers and postfix.
http://www.google.com – a useless place to go when you have no answers and seek for more questions and confusion about this matter.

— 080813 Update —
You might want to change the line at sendmail.cf :
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1,Name=MTA’)dnl

replacing 127.0.0.1 with your machine’s ip that way sendmail will work right (this fix the issue of not being able to receive emails due connection refused, you can also test if it’s working by telnet mail.yourserver.com 25 or by netstat -nl to list the listening connections)

Leave a Comment :, , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!