Using Google Mail as SMTP Server

7,597 views
Skip to first unread message

Rosti

unread,
Mar 21, 2017, 10:21:59 PM3/21/17
to Caché, Ensemble, DeepSee
Hi,

Found these instructions that seemed reasonable for the task..

Settings

Google's SMTP server requires authentication, so here's how to set it up:

  1. SMTP server (i.e., outgoing mail): smtp.gmail.com
  2. SMTP username: Your full Gmail or Google Apps email address (e.g. exa...@gmail.com or exa...@yourdomain.com)
  3. SMTP password: Your Gmail or Google Apps email password
  4. SMTP port: 465
  5. SMTP TLS/SSL requiredyes
  6. In order to store a copy of outgoing emails in your Gmail or Google Apps Sent folder, log into your Gmail or Google Apps email Settings and:
  7. Click on the Forwarding/IMAP tab and scroll down to the IMAP Access section: IMAP must be enabled in order for emails to be properly copied to your sent folder.

I have set up a routine that works well with another Mail Server and applied the mods to suit the Google settings..


ClassMethod HotPOPAsSMTP() As %Net.SMTP
{
  Set server=##class(%Net.SMTP).%New()
  Set server.smtpserver="ssmtp.gmail.com"
  Set server.port=465

  
  //Create object to carry authentication
  Set auth=##class(%Net.Authenticator).%New()
  Set auth.UserName="ros...@gmail.com"
  Set auth.Password="xxxxx"

  Set server.AuthFrom="" 
  Quit server
}


Looked up the docs on the %Net. SMTP and the properties on offer include..

server.SSLConfiguration
server.authenticator

Just cannot decipher from the notes, how to 'activate' TLS/SSL for Google.

If anyone has done this before with success, what is the correct process for enabling this?

Thanks,
Rosti.

Dmitry Maslennikov

unread,
Mar 22, 2017, 4:40:40 AM3/22/17
to intersystems...@googlegroups.com
Create new SSL/TLS configuration through Portal manually, the only name should be filled.
and you can use this name in SSLConfiguration property, in SMTP or HTTRequest, or any other places which need SSL access.

Programmatically 
Method GetSSLConfiguration(name = "google") {
  new $namespace
  set $namespace="%SYS"
  if '##class(Security.SSLConfigs).Exists(name) {
    set tSC=##class(Security.SSLConfigs).Create(name)
    $$$ThrowOnError(tSC)
  }
  quit name
}

pasted2

--
--
Caché, Ensemble, DeepSee

---
You received this message because you are subscribed to the Google Groups "Caché, Ensemble, DeepSee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to intersystems-publi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Dmitry Maslennikov
Senior Caché Developer
C SYSTEM CZ a.s. http://csystem.cz/
Skype: DAiMor

Rosti

unread,
Mar 22, 2017, 5:36:46 AM3/22/17
to Caché, Ensemble, DeepSee
Dmitry,

OK, thanks. So I have created the New SSL/TLS Configuration. If I add the Method you have outlined to my Namespace as part of my say System.cls Class, WHERE and HOW is this method called? In my HotPOPAsSMTP() ClassMethod?


Thanks,
Rosti.


On Wednesday, March 22, 2017 at 1:21:59 PM UTC+11, Rosti wrote:
Hi,

Found these instructions that seemed reasonable for the task..

Settings

Google's SMTP server requires authentication, so here's how to set it up:

  1. SMTP server (i.e., outgoing mail): smtp.gmail.com
  1. SMTP username: Your full Gmail or Google Apps email address (e.g. example@gmail.com or exa...@yourdomain.com)
  1. SMTP password: Your Gmail or Google Apps email password
  2. SMTP port: 465
  3. SMTP TLS/SSL requiredyes
  4. In order to store a copy of outgoing emails in your Gmail or Google Apps Sent folder, log into your Gmail or Google Apps email Settings and:
  5. Click on the Forwarding/IMAP tab and scroll down to the IMAP Access section: IMAP must be enabled in order for emails to be properly copied to your sent folder.
I have set up a routine that works well with another Mail Server and applied the mods to suit the Google settings..


ClassMethod HotPOPAsSMTP() As %Net.SMTP
{
  Set server=##class(%Net.SMTP).%New()
  Set server.smtpserver="ssmtp.gmail.com"
  Set server.port=465

  
  //Create object to carry authentication
  Set auth=##class(%Net.Authenticator).%New()
  Set auth.UserName="rostiz@gmail.com"
  Set auth.Password="xxxxx"

  Set server.AuthFrom="" 
  Quit server
}

Dmitry Maslennikov

unread,
Mar 22, 2017, 6:19:20 AM3/22/17
to Caché, Ensemble, DeepSee
Something like this
set server.SSLConfiguration=..GetSSLConfiguration("google")

On Wed, Mar 22, 2017 at 10:36 AM Rosti <ros...@gmail.com> wrote:
Dmitry,

OK, thanks. So I have created the New SSL/TLS Configuration. If I add the Method you have outlined to my Namespace as part of my say System.cls Class, WHERE and HOW is this method called? In my HotPOPAsSMTP() ClassMethod?


Thanks,
Rosti.


On Wednesday, March 22, 2017 at 1:21:59 PM UTC+11, Rosti wrote:
Hi,

Found these instructions that seemed reasonable for the task..

Settings

Google's SMTP server requires authentication, so here's how to set it up:

  1. SMTP server (i.e., outgoing mail): smtp.gmail.com
  1. SMTP username: Your full Gmail or Google Apps email address (e.g. exa...@gmail.com or exa...@yourdomain.com)
  1. SMTP password: Your Gmail or Google Apps email password
  2. SMTP port: 465
  3. SMTP TLS/SSL requiredyes
  4. In order to store a copy of outgoing emails in your Gmail or Google Apps Sent folder, log into your Gmail or Google Apps email Settings and:
  5. Click on the Forwarding/IMAP tab and scroll down to the IMAP Access section: IMAP must be enabled in order for emails to be properly copied to your sent folder.
I have set up a routine that works well with another Mail Server and applied the mods to suit the Google settings..


ClassMethod HotPOPAsSMTP() As %Net.SMTP
{
  Set server=##class(%Net.SMTP).%New()
  Set server.smtpserver="ssmtp.gmail.com"
  Set server.port=465

  
  //Create object to carry authentication
  Set auth=##class(%Net.Authenticator).%New()
  Set auth.UserName="ros...@gmail.com"
  Set auth.Password="xxxxx"

  Set server.AuthFrom="" 
  Quit server
}


Looked up the docs on the %Net. SMTP and the properties on offer include..

server.SSLConfiguration
server.authenticator

Just cannot decipher from the notes, how to 'activate' TLS/SSL for Google.

If anyone has done this before with success, what is the correct process for enabling this?

Thanks,
Rosti.

--
--
Caché, Ensemble, DeepSee

---
You received this message because you are subscribed to the Google Groups "Caché, Ensemble, DeepSee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to intersystems-publi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rosti

unread,
Mar 22, 2017, 7:45:55 AM3/22/17
to Caché, Ensemble, DeepSee
Dmitry,

Did this, but got a compile error..


The "google" SSL/TLS configuration is set up in the %SYS name space, the  ClassMethod HotPOPAsSMTP() is 'dinners' name space - is this OK?

Sorry to hassle, but there is an outage in my Mail Server's ADSL and I need to switch to some other SMTP Server to get email going from applications.

Thanks,
Rosti.


On Wednesday, March 22, 2017 at 1:21:59 PM UTC+11, Rosti wrote:
Hi,

Found these instructions that seemed reasonable for the task..

Settings

Google's SMTP server requires authentication, so here's how to set it up:

  1. SMTP server (i.e., outgoing mail): smtp.gmail.com
  1. SMTP username: Your full Gmail or Google Apps email address (e.g. example@gmail.com or exa...@yourdomain.com)
  1. SMTP password: Your Gmail or Google Apps email password
  2. SMTP port: 465
  3. SMTP TLS/SSL requiredyes
  4. In order to store a copy of outgoing emails in your Gmail or Google Apps Sent folder, log into your Gmail or Google Apps email Settings and:
  5. Click on the Forwarding/IMAP tab and scroll down to the IMAP Access section: IMAP must be enabled in order for emails to be properly copied to your sent folder.
I have set up a routine that works well with another Mail Server and applied the mods to suit the Google settings..


ClassMethod HotPOPAsSMTP() As %Net.SMTP
{
  Set server=##class(%Net.SMTP).%New()
  Set server.smtpserver="ssmtp.gmail.com"
  Set server.port=465

  
  //Create object to carry authentication
  Set auth=##class(%Net.Authenticator).%New()
  Set auth.UserName="rostiz@gmail.com"
  Set auth.Password="xxxxx"

  Set server.AuthFrom="" 
  Quit server
}
Reply all
Reply to author
Forward
0 new messages