eZ Community » Forums » Install & configuration » Sending Mail via gmail or Google Apps...
expandshrink

Sending Mail via gmail or Google Apps SMTP

Sending Mail via gmail or Google Apps SMTP

Monday 26 May 2008 3:00:46 pm - 6 replies

Hello

I want to configure ezpublish 4.0.0 to send emails through a Google Apps account. The problem is that Google Apps is using SSL to encode SMTP access, and I can not see how to configure this in ezpublish.

Best regards
Stefan

Monday 26 May 2008 8:42:07 pm

not possible at the moment

Sunday 01 June 2008 4:18:04 pm

I did some research, and I hope this brief summary would help the others which would like to use GMail as their SMTP servers.

For those who prefer GMail/Google Apps mail as a mail server, I am posting brief note about the available options. The explanation is generic, and not limited to particular verions of eZ Publish, or even to eZ Publish. Since eZ Publish 4.0.0 is used as example, I would remind the eZ Publish 4.0.0 users to check http://ez.no/doc/ez_publish/techn...iles/site_ini/mailsettings/transport in case of problems accessing the local SMTP service.

There are two options for sending email through GMail from CMS withouth SMTP/TLS support:
1. Installation of a SSL tunnel, which encrypts the plan SMTP communication between your CMS mailer and Google's SMTP server.
2. Configuration of a smart (http://en.wikipedia.org/wiki/Smart_host) host mail transport agent (MTA) which sends the mails on CMS's behalf through GMail. Needless to say, this email server needs to be both supported by the CMS, and to support TLS relaying of SMTP. If TLS relaying of SMTP is not supported, we still have the same two options, and sort of infinte recursion.

1. A SSL tunnel can be found on http://stunnel.org. On a Linux distribution, chances are that it is available through the distribution's package manager. On my Ubuntu 8.04, I write

sudo apt-get install stunnel4

, enable the service in

/etc/default/stunnel

, and edit the stunnel configuration file:

sudo nano /etc/stunnel/gmail-smtp.conf

:

#...
; Use it for client mode
client = yes

; Service-level configuration
[ssmtp]
accept  = 1925
connect = smtp.gmail.com:465

Then, I configure the mail client of my CMS to use server on localhost:1925 (not smtp.gmail.com), and that's it. As a fast check, I type

telnet localhost 1925
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mx.google.com ESMTP XXXXXXXXXXXXX

(just write <i>quit</i> to get out.)

For eZ Publish, mail settings would be:

[MailSettings]
Transport=SMTP
TransportServer=localhost:1925
TransportUser=name@gmail.com
TransportPassword=pASSwor-d
AdminEmail=name@gmail.com
EmailSender=name@gmail.com

2. As an example for the smart host solution, I am presenting an Exim 4 MTA configuration. Please, make sure you do understand implications of installation (re)configuration and securing of a mail server before you continue.
Debian and Ubuntu users may look at http://wiki.debian.org/GmailAndExim4 for detailed step-by-step instructions. After the procedure my

/etc/exim4/update-exim4.conf.conf

looked like this:

#...
# This is a Debian specific file
dc_eximconfig_configtype='satellite'
dc_other_hostnames=''
dc_local_interfaces='127.0.0.1'
dc_readhost='gmail.com'
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost='smtp.gmail.com::587'
CFILEMODE='644'
dc_use_split_config='true'
dc_hide_mailname='true'
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'

(note the double column in

dc_smarthost='smtp.gmail.com::587'

).

And

/etc/exim4/passwd.client

is:

#...
# Example:
### target.mail.server.example:login:password
smtp.gmail.com:name@gmail.com:pASSwor-d
gmail-smtp.l.google.com:name@gmail.com:pASSwor-d

To test that the installation is working, I try:

telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 cheffo-desktop ESMTP Exim 4.69 Sun, 01 Jun 2008 15:37:51 +0300

(just write <i>quit</i> to get out.)

The MTA now can be used by the CMS either directly (as Sendmail compatible program, as supported by eZ Publish), or via its own, non-TLS SMTP port. <b>Important</b> this configuration of Exim does not require password for sending mails.

Mail settings for eZ Publish, with Sendmail sending option:

[MailSettings]
Transport=sendmail

Mail settings for eZ Publish, with SMTP sending option:

[MailSettings]
Transport=SMTP
TransportServer=localhost:25
TransportUser=name@gmail.com
TransportPassword=
AdminEmail=name@gmail.com
EmailSender=name@gmail.com

(Note that

TransportPassword

option is empty).

Modified on Sunday 01 June 2008 4:24:34 pm by Stefan Kolarov

Friday 12 December 2008 9:28:45 pm

I posted a fix to SMTP class to support SSL

here is the post:

http://ez.no/developer/forum/inst...or_smtp/re_is_ssl_supported_for_smtp

Saturday 12 November 2011 8:23:20 pm

Hi,

I try to configure stunnel4 on my server. I started stunnel. No errors.

But, when I test with telnet, here's the result:

telnet localhost 1925
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host. 

An idea to solve my problem?

Cheers

Modified on Saturday 12 November 2011 8:24:12 pm by Sylvain Guittard

Sunday 13 November 2011 3:38:22 pm

I solved my problem : bad configuration of my firewall.

Monday 14 November 2011 11:09:56 am

I solved my problem : bad configuration of my firewall.

All good !

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from