User Tools

Site Tools


sending_e-mail_with_ssmtp

If you want to send us your comments, please do so. Thanks
More on comments


Sending e-mail

sendemail

This is a CLI smtp client which can send an e-mail to an smtp server

When using -bcc in combination with an IMAP account the e-mail can land in the IMAP account although you fetch it with a client which normally transfers the e-mail to local mail. Using the -t option can be a solution to solve this issue

Example commands

sendemail -f sender@sendersdomainl -s smtp.somehost.nl:port \
-xu e-mailAccountUsername -xp e-mailAccountPassword -t receiversName@domain.nl \
-o tls=yes -u theSubject -m  "Your message"
sendemail -vvvvv -f sender@sendersdomainl -s smtp.somehost.nl:465 \
-t receiversName@domain.nl -u theSubject 
-m "Your message" -f sender@sendersdomainl -vvvvv

Use 's around the password to escape special characters

sendemail -l ~/sendmail.log -q -f "senders name <sender@sendersdomain.nl>" -s mail.somehost.nl:587 \
-xu sender@sendersdomain.nl -xp "e-mailAccountPassword" \
-bcc receiversName@domain.nl, OtherReceiversName@otherdomain.nl \
-o reply-to=otherSender@sendersdomain.nl -o timeout=10 -o tls=auto \
-u "Hello" -m "Just a test"

-s smtp server
-f senders e-mail address
-t receivers e-mail address
-u Subject
-m Message body
-v Verbose, more v's → more verbose

ssmtp

ssmtp is a send-only sendmail emulator
ssmtp has no local e-mail so it can not send cron output to /var/mail/user

sSMTP revaliases, aliases and mail.rc

  • fetchmail
  • mailq - show contents of the e-mail queue
  • /etc/mail.rc
  • /etc/mailname
  • /etc/ssmtp/ssmtp.conf
  • /var/spool/mail/user ( Mail spool )
  • /root/dead.letter
  • /home/user/dead.letter
  • /usr/sbin/sendmail
  • /var/log/mail.err
  • /var/log/mail.log
ls -l /usr/sbin/sendmail

should show

lrwxrwxrwx 1 root root 5 jun 30  2012 /usr/sbin/sendmail -> ssmtp

Configuration file

Sending e-mail to external smtp server

/etc/ssmtp/ssmtp.conf :

# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
#root=user
#user=user

# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.internetprovider.nl:465

# Where will the mail seem to come from?
rewriteDomain=hostname.nl

# The full hostname
hostname=This7is8The9Hostname

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
# E-mail 'From header's can override the default domain?
FromLineOverride=NO

# Use SSL/TLS before starting negotiation
UseTLS=Yes
#UseSTARTTLS=Yes

# Username/Password
#AuthUser=username
#AuthPass=password

How it looks in the headers

hostname:

Received: by This7is8The9Hostname (sSMTP sendmail emulation); Mon, 06 Jul 2015 19:34:01 +0000

UseTLS

(using TLSv1 with cipher AES128-SHA (128/128 bits))


When sending an e-mail with

mail name@domain.nl

this error can occur

WARNING: gnome-keyring:: couldn't connect to: /home/user/.cache/keyring-hash/pkcs11: Connection refused

This is an issue that has to be solved

TO aliases

Aliases for TO can be set in

/etc/mail.rc

example

alias user user<yourname@youre-mailprovider.com>

sSMTP does not read

/etc/aliases

which would otherwise also be a possibility

FROM aliases

Form aliases can be set in

/etc/ssmtp/revaliases

example

user:username@e-mailprovider.com:smtp.e-mailprovider.com:465
john:john734@yandex.com:smtp.yandex.com:465

is only the aliases for the FROM: addresses.

Error messages

Invalid response SMTP server

Possible solution change

#UseTLS=Yes

to

UseTLS=Yes

# Is comment in the config file

Discussion list

On Wikipedia

Mailman is as far as we know the only discussion list application in the Debian repository


Main subjects on this wiki: Linux, Debian, HTML, Microcontrollers, Privacy

RSS
Disclaimer
Privacy statement
Bugs statement
Cookies
Copyright © : 2014 - 2024 Webevaluation.nl and the authors
Changes reserved.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
sending_e-mail_with_ssmtp.txt · Last modified: 28-09-2023 10:00 by wim