Sendmail: Difference between revisions

From Halfface
Jump to navigation Jump to search
Line 41: Line 41:
  smtp.bredband.net smtp
  smtp.bredband.net smtp


<pre>
==smarthost==
set smarthost and domain.
set smarthost and domain.
/etc/mail/sendmail.mc
/etc/mail/sendmail.mc
Line 48: Line 48:
LOCAL_DOMAIN(`www.halfface.se')dnl
LOCAL_DOMAIN(`www.halfface.se')dnl


==sendmail listen on all network interfaces==
Enable smtp on all interfaces.
Enable smtp on all interfaces.


Line 53: Line 54:
DAEMON_OPTIONS(`Port=smtp,Name=MTA')dnl
DAEMON_OPTIONS(`Port=smtp,Name=MTA')dnl


Usermappings.
==Usermappings==


/etc/mail/virtusertable
/etc/mail/virtusertable
Line 68: Line 69:
@anden.homeip.net              bjorklun
@anden.homeip.net              bjorklun


----
 
aliases for your host
==aliases for your host==
<verbatim>
<verbatim>
/etc/mail/local-host-names
/etc/mail/local-host-names
Line 81: Line 82:
sivberg.se
sivberg.se


----
 
Access rights. Who can send mail and username and password at www.bredband.net smtp server.
==Access rights. Who can send mail and username and password at www.bredband.net smtp server.==
<verbatim>
<verbatim>
/etc/mail/access
/etc/mail/access
Line 93: Line 94:
AuthInfo:smtp.bredband.net "U:b586378" "I:b586378" "P:??????" "M:LOGIN PLAIN"
AuthInfo:smtp.bredband.net "U:b586378" "I:b586378" "P:??????" "M:LOGIN PLAIN"


----
 
Forward a copy of email.
==Forward a copy of email.==


~/.forward
~/.forward
Line 101: Line 102:
andreas.bjorklund@infineon.com
andreas.bjorklund@infineon.com


</pre>
==sending mail from command line==
From: "From hoever" <email@inter.net>
To: "Andreas halfface Bjorklund" <email@inter.net>
Subject: Test Email
MIME-Version: 1.0
Content-Type: text/plain
Andreas Bjorklund doing test. anden@halfface.se
# cat /tmp/sendmail.txt | sendmail -i -t
 
 
[[Category:Applications]]
[[Category:Applications]]
[[Category:Unix]]
[[Category:Unix]]

Revision as of 10:31, 21 December 2012

resend mails

sendmail -q -v

delete mails from a recipiant

sendmail -qR -v hotmail.com

Who owns mails with problem

mailq | grep @ | grep -v ^k | cut -d \< -f 2 | cut -d @ -f2 | awk '{print $1}' | sort | uniq -c | sort -n | grep -v `hostname` | cut -d \> -f 1| tail

send mail with netcat

[user@host]# telnet smtp.domain.com 25
Trying 192.168.0.1...
Connected to smtp.domain.com (192.168.0.1).
Escape character is '^]'.
220 myrelay.domain.com ESMTP
HELO smtp.domain.com
250 myrelay.domain.com
MAIL FROM:<alice@hacker.com>
250 sender <alice@hacker.com> ok
RCPT TO:<bob@secure.net>
250 recipient <bob@secure.net> ok
DATA
354 go ahead
From: [Alice Hacker] <alice@hacker.com>
To: [Bob Smith] <bob@secure.net>
Date: Mon, 12 Apr 2010 14:21:26 -0400
Subject: Test Message

Hi there!
This is supposed to be a real email...

Have a good day!
Alice


.
250 ok:  Message 222220902 accepted
QUIT
221 myrelay.domain.com
Connection closed by foreign host.

SMTP servers for internet providers

mailrelay.bostream.com 		smtp
smtp.bredband.net		smtp

smarthost

set smarthost and domain. /etc/mail/sendmail.mc define(`SMART_HOST', `smtp.bredband.net')

LOCAL_DOMAIN(`www.halfface.se')dnl

sendmail listen on all network interfaces

Enable smtp on all interfaces.

/etc/mail/sendmail.mc DAEMON_OPTIONS(`Port=smtp,Name=MTA')dnl

Usermappings

/etc/mail/virtusertable

anden@halfface.se bjorklun andreas.bjorklund@halfface.se bjorklun stannaks@halfface.se stannaks none@halfface.se error:nouser 550 No such user here wrong@halfface.se error:5.7.0:550 Address invalid @halfface.se bjorklun anna-karin@sivberg.se stannaks @sivberg.se stannaks @mobbad. bjorklun @anden.homeip.net bjorklun


aliases for your host

<verbatim> /etc/mail/local-host-names

anden.homeip.net www.halfface.se halfface.se www.mobbad.nu mobbad.nu www.sivberg.se sivberg.se


Access rights. Who can send mail and username and password at www.bredband.net smtp server.

<verbatim> /etc/mail/access

localhost.localdomain RELAY localhost RELAY 127.0.0.1 RELAY 192.168.2.1 RELAY 192.168.3.1 RELAY AuthInfo:smtp.bredband.net "U:b586378" "I:b586378" "P:??????" "M:LOGIN PLAIN"


Forward a copy of email.

~/.forward

\bjorklun andreas.bjorklund@infineon.com

sending mail from command line

From: "From hoever" <email@inter.net>
To: "Andreas halfface Bjorklund" <email@inter.net>
Subject: Test Email
MIME-Version: 1.0
Content-Type: text/plain

Andreas Bjorklund doing test. anden@halfface.se

# cat /tmp/sendmail.txt | sendmail -i -t