mail

IMAP mail server

Syntax Login A1 LOGIN username password Values can be quoted to enclose spaces and special characters. A " must then be escape with a A1 LOGIN “username” “password” List Folders/Mailboxes A1 LIST "" * A1 LIST INBOX * A1 LIST “Archive” * Create new Folder/Mailbox A1 CREATE INBOX.Archive.2012 A1 CREATE “To Read” Delete Folder/Mailbox A1 DELETE INBOX.Archive.2012 A1 DELETE “To Read” Rename Folder/Mailbox A1 RENAME “INBOX.

Telnet to mail server

Lets first create a variable, so you can just copy/paste the code. Replace mail.example.net with your telnet destination domain name. export REMOTE_SRV=mail.example.net telnet start $ telnet $REMOTE_SRV 25 $ telnet $REMOTE_SRV 143 c = Client, this is what you will enter s = Server, response we receive. c: telnet $REMOTE_SRV 587 s: Trying 107.189.21.115... s: Connected to mail.example.net. s: Escape character is '^]'. s: 220 mail.example.net ESMTP Citadel server ready.

msmtp

/etc/msmtprc defaults maildomain example.net syslog LOG_MAIL aliases /etc/aliases account default host mail.example.net port 587 from srv7@example.net auth on user user@example.net password ******** tls on tls_starttls on #tls_certcheck off tls_fingerprint DB:A0:2A:07:00:F9:E3:23:7D:07:E7:52:3C:95:9D:E6:7E:12:54:3F You may need a manual for a tls fingerprint Your alias file # /etc/aliases default: me@example.net A php script to send mail #!/usr/bin/php <?php define('TAB',"\t"); $user = $_SERVER['LOGNAME']; $host = exec("hostname -f"); $from = $user.'@'.$host; $to = 'sweety@example.net'; $subject = 'Testing msmtp'; $message = 'hello from '.

Send mail with sendmail

#!/bin/bash SENDMAIL=/usr/sbin/sendmail RECIPIENT=tosomeone@example.com FROM=me@example.com cat <<EOF | $SENDMAIL -t ${RECIPIENT} From: ${FROM} To: ${RECIPIENT} Subject: testmail some test text as body of the email. EOF

msmtp install, config and test

Why have more then one mail server? Or why even have a mail server at all, if you can use gmail? Well there are many reasons to have at leased one mail server, but having one on each server doesn’t make sense at all. I tried both ssmtp and msmtp, and decided on msmtp. msmtp is an SMTP client. In the default mode, it transmits a mail to an SMTP server, which takes care of further delivery.