Tikejhya: Ashish Nepal

Knowledgebase

Category: sendmail

mail command with from address

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

echo “no-reply” | mail  -r no-reply@test.com -s “something” tikejhya@hotmail.com

# Setting reply to address
export REPLYTO=tikejhya@hotmail.com; echo “This is the main body of the mail” | mail -s “Subject of the Email” -r tikejhya@hotmail.com tikejhya@hotmail.com

postfix smtp relay

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

echo “mail.test.com    no-reply@Test.com:PASSWORD” > /etc/postfix/saslpass

 

vi /etc/postfix/main.cf

relayhost = [mail.test.com]:587
smtp_sasl_auth_enable = yes
smtp_use_tls=yes
smtp_sasl_password_maps = hash:/etc/postfix/saslpass
smtp_sasl_security_options = noanonymous

 

Postfix DKIM

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

What is DKIM?

For funtional overview visit:
http://www.sendmail.co.uk/sm/open_source/dkim/functional_overview/

DKIM or DomainKeys Identified Mail is an electronic signature that is inserted into the full header of your email to identify the origin of where the message was sent.

Howto?

# Install opendkim, which is fork of dkim-milter.
yum install opendkim

# Create directory for you domain, generate key, change ownership.
mkdir /etc/opendkim/keys/mydomain.com
opendkim-genkey -D /etc/opendkim/keys/mydomain.com/ -d mydomain.com -s default
chown -R opendkim:opendkim /etc/opendkim/keys/mydomain.com
mv /etc/opendkim/keys/mydomain.com/default.private /etc/opendkim/keys/mydomain.com/default

# If you have multiple domain, do same for each domain.

# Configuration File
/etc/opendkim.conf – OpenDKIM’s main configuration file
/etc/opendkim/KeyTable – a list of keys available for signing
/etc/opendkim/SigningTable - a list of domains and accounts allowed to sign
/etc/opendkim/TrustedHosts – a list of servers to “trust” when signing or verifying

# vi /etc/opendkim.conf
PidFile /var/run/opendkim/opendkim.pid
Mode sv
Syslog yes
SyslogSuccess yes
LogWhy yes
UserID opendkim:opendkim
Socket inet:8891@localhost
Umask 002

Canonicalization relaxed/simple
Selector default
MinimumKeyBits 1024
KeyFile /etc/opendkim/keys/default.private
KeyTable /etc/opendkim/KeyTable
SigningTable refile:/etc/opendkim/SigningTable
ExternalIgnoreList refile:/etc/opendkim/TrustedHosts
InternalHosts refile:/etc/opendkim/TrustedHosts

# vi /etc/opendkim/KeyTable
default._domainkey.mydomain.com mydomain.com:default:/etc/opendkim/keys/mydomain.com/default

# If you have multiple domain add similar line with each domain

# vi /etc/opendkim/SigningTable
*@mydomain.com default._domainkey.mydomain.com

vi /etc/opendkim/TrustedHosts
127.0.0.1

# If you want to add simillar trusted domain or ip add in Trusted host file.

# Now Make postfix aware where to go for smtpd milter
smtpd_milters = inet:127.0.0.1:8891
non_smtpd_milters = $smtpd_milters
milter_default_action = accept

# If you’re running a version of Postfix prior to 2.6, you may need to add:
milter_protocol = 2

Service opendkim start
service postfix reload

Add DNS entry with the key you created for each domain which can be found under.
/etc/opendkim/keys/mydomain.com/default.txt

Test:
By sending a blank email to the following address : sa-test@sendmail.net or check-auth@verifier.port25.com or autorespond+dkim@dk.elandsys.com and check the respon.

Or, check header of email message.

Checking Mail server reputation:
https://www.senderscore.org/
http://mxtoolbox.com/SuperTool.aspx

Openrelay Test:
http://www.mailradar.com/openrelay/

Test Openrelay Telnet:

telnet: > telnet mx1.example.com smtp
telnet: Trying 192.0.2.2…
telnet: Connected to mx1.example.com.
telnet: Escape character is ‘^]’.
server: 220 mx1.example.com ESMTP server ready Tue, 20 Jan 2004 22:33:36 +0200
client: HELO client.example.com
server: 250 mx1.example.com
client: MAIL from:
server: 250 Sender Ok
client: RCPT to:
server: 250 Recipient Ok
client: DATA
server: 354 Ok Send data ending with .
client: From: sender@example.com
client: To: recipient@example.com
client: Subject: Test message
client:
client: This is a test message.
client: .
server: 250 Message received: 20040120203404.CCCC18555.mx1.example.com@client.example.com
client: QUIT
server: 221 mx1.example.com ESMTP server closing connection

Using MSMTP

This article guide’s how to install msmtp and use instead of sendmail.

Remove sendmail
yum remove sendmail
[y]

download msmtp latest version
http://sourceforge.net/projects/msmtp/files/msmtp/

Choose appropriate one and unzip/untar

And,

cd /usr/local/etc/
vi msmtprc
# MSMTP config for me

account default

host mailsvr.ashishnepal.com
protocol smtp
auto_from on
maildomain me.ashishnepal.com
logfile /var/log/maillog

cd /etc/mail/msmtprc
ln -s /usr/local/etc/msmtprc msmtprc
[root@ashish mail]# ll /etc/mail/msmtprc
lrwxrwxrwx 1 root root 22 Aug 5 2011 /etc/mail/msmtprc -> /usr/local/etc/msmtprc

cd /usr/sbin
ln -s /usr/local/bin/msmtp sendmail

[root@ashish mail]# ll /usr/sbin/sendmail
lrwxrwxrwx 1 root root 20 Sep 6 2011 /usr/sbin/sendmail -> /usr/local/bin/msmtp

Sendmail SMART_HOST Relay -Howto

# Creating Relay with external mail server
# (lets take relay external mail server as ashish.com)

Open your configuration file:

# vi /etc/mail/sendmail.mc

Append or modify macro that read as follows :

define(`SMART_HOST',`myrelay.ashishnepal.com')
# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

Restart sendmail service:

# /etc/init.d/sendmail restart

Problem: /etc/mail/sendmail.mc:10: m4: Cannot open /usr/share/sendmail-cf/m4/cf.m4:

yum install sendmail-cf

Problem: ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30053, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

This is potentially due to your mail service is not running or amavisd is looping into localhost
Lets assume you are using sendmail

# killall -9 sendmail
# /etc/init.d/sendmail start

Powered by WordPress & Theme by Anders Norén