You are here: Foswiki>Tasks Web>Item4913 (22 Mar 2011, GeorgeClark)Edit Attach

Using ssmtp, Mail handler can support SMTP TLS on port 465 or 587. e.g. GMail.

My (MartinCleaver) thanks to WillNorris for finding this solution and helping me to implement it.

http://www.linux.com/archive/feature/132006

> Unfortunately, Sendmail configuration is a mass of twisty passages that even the most experienced user avoids if at all possible. That means it is not the best tool for the typical desktop user.
> Instead of finding a complicated replacement for mail, you can replace the complicated Sendmail with a simple alternative: sSMTP. sSMTP simplifies configuring your SMTP options with a small configuration file that allows you to specify items like the name of the remote SMTP server, your authorization (username and password), and the domain for your outbound email in much the way you configure your mail reader.
> You can install sSMTP through your distribution's package manager, or build and install it from source.

$ cat /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=foswiki@mydomain.com

# 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.gmail.com:587

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

# The full hostname
hostname=mydomain.com

UseSTARTTLS=YES
AuthUser=foswiki@mydomain.com
AuthPass=YOURGMAILPASSWORD

# 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
FromLineOverride=YES
# Use SSL/TLS certificate to authenticate against smtp host.
#UseTLSCert=YES

NB. Using gmail apps for domains you can use your domain name but hosted by Google

Test on the command line

  • Now try sending an email
  • You can send an email through your favorite email client, like ‘mutt‘, or type:
  • sudo ssmtp someemail@email.com
  • You will then type your message, hit enter and ‘ctrl+d‘

Test in Foswiki

Then in LocalLib.cfg
  • Don't change {MailProgram}
    • As installing ssmtp will replace your sendmail binary
  • Empty all entries prefixed by {SMTP}
  • Try something, like registering!

-- WillNorris, MartinCleaver


Original issue description follows.

-- TWiki:Main/KwangErnLiew - 30 Oct 2007

Would anyone please get a chance of getting this patched? smile

-- TWiki:Main.KwangErnLiew - 26 Feb 2008

Candidate solution code at http://twiki.org/cgi-bin/view/Support/StartTlsNotIssedWhileSendingMail

Related:

-- MartinCleaver - 14 Nov 2008

http://develop.twiki.org/~twiki4/cgi-bin/view/Bugs/Item2292 says this is fixed?

MartinCleaver: Is TWiki supposed to support Gmail as outbound email?
[9:37pm] SvenDowideit: nope
[9:37pm] SvenDowideit: gmail has some 'specialness'
[9:37pm] MartinCleaver: This is http://nextwiki.org/Tasks/Item4913 ?
[9:37pm] MartinCleaver: TLS stuff?
[9:38pm] MartinCleaver: TLS is different to authenticated SMTP?
[9:38pm] SvenDowideit: pass, don't use gmail, so not read the docco
[9:38pm] MartinCleaver: ok
[9:38pm] MartinCleaver: thx
[9:38pm] SvenDowideit: there are at least 2 topics on it on t.o tho
[9:48pm] MartinCleaver: http://www.google.ca/search?q=site%3Atwiki.org++tls&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a TLS search only really on http://twiki.org/cgi-bin/view/Support/StartTlsNotIssedWhileSendingMail
[9:49pm] MartinCleaver: Uses http://www.logix.cz/michal/devel/smtp/
[9:50pm] MartinCleaver: http://search.cpan.org/~awestholm/Net-SMTP-TLS-0.12/lib/Net/SMTP/TLS.pm looks simple enough
[9:52pm] MartinCleaver: uses the above .cz stuff
[9:58pm] MartinCleaver: hmm. Doesn't install
[9:59pm] MartinCleaver: Needs Net::SSLeay - that needs openssl but fails when its not installed without saying that openssl missing will kill t
[9:59pm] tsnfoo joined the chat room.
[10:01pm] MartinCleaver: Hmm. No, it says *** Found OpenSSL-0.9.8c installed in /usr
[10:01pm] MartinCleaver: *** Be sure to use the same compiler and options to compile your OpenSSL, perl,
[10:01pm] MartinCleaver:     and Net::SSLeay. Mixing and matching compilers is not supported.
[10:02pm] MartinCleaver: Then SSLeay.xs:92:25: error: openssl/err.h: No such file or directory
[10:02pm] MartinCleaver: before random errors like
[10:02pm] MartinCleaver: SSLeay.xs:103:28: error: openssl/engine.h: No such file or directory
[10:02pm] MartinCleaver: SSLeay.xs:122: error: expected ';', ',' or ')' before '*' token
[10:02pm] MartinCleaver: SSLeay.xs:123: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
[10:02pm] MartinCleaver: SSLeay.xs:124: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
[10:03pm] SvenDowideit: you need to check your feet for holes
[10:03pm] MartinCleaver: I'm certainly feeling cross
[10:03pm] SvenDowideit: cos it sounds like you've simply not installed the openssl dev package
[10:04pm] MartinCleaver: if its missing .h files, wouldn'
[10:04pm] MartinCleaver: extranet:~# apt-get install openssl-dev 
[10:04pm] MartinCleaver: Reading package lists... Done
[10:04pm] MartinCleaver: Building dependency tree... Done
[10:04pm] MartinCleaver: E: Couldn't find package openssl-dev
[10:04pm] MartinCleaver: case sensitive?
[10:04pm] SvenDowideit: and once you're missing a header, the rest of the errors will be related
[10:04pm] MartinCleaver: y
[10:05pm] MartinCleaver: E: Couldn't find package OpenSSL-dev
[10:05pm] gac410 left the chat room. ("Leaving.")
[10:06pm] MartinCleaver: Hmm. Looks like gmail ain't going to work cleanly even once it is installed:
[10:06pm] MartinCleaver: http://rt.cpan.org/Public/Bug/Display.html?id=39827
[10:08pm] MartinCleaver: In fact there are at least 2 unapplied patches, dating more than 1 year on http://rt.cpan.org/Public/Dist/Display.html?Name=Net-SMTP-TLS
[10:09pm] SvenDowideit: brilliant  an oportunity for you
[10:09pm] MartinCleaver: Use another mail server is the answer, methinks
[10:10pm] • MartinCleaver updates his ticket


ItemTemplate edit

Summary SMTP TLS support (i.e. Gmail is now supported)
ReportedBy TWiki:Main.KwangErnLiew, MartinCleaver, WillNorris
Codebase
SVN Range TWiki-4.3.0, Fri, 12 Oct 2007, build 15261
AppliesTo Engine
Component FoswikiUIRegister, FoswikiNet
Priority Low
CurrentState Closed
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
Topic revision: r7 - 22 Mar 2011, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy