Forums >> BVSTools >> BVSTools Software Discussion >> Email Tools (MAILTOOL) Specific Discussion >>
Setting up MAILTOOL to work with Cloud Services such as GMail or Outlook, or Office 365



Posted:
bvstone

Setting up MAILTOOL to work with Cloud Services such as GMail or Outlook, or Office 365

 
Setting up MAILTOOL to work with Cloud Services such as GMail or Outlook, or Office 365

Many of our customers are making the switch to use GMail, Microsoft (Office 365) or even Yahoo for business as their email provider.  These systems replace older Microsoft Exchange or other in house email solutions.

One issue with this is these cloud services often require more security for the communications, such as authentication with a user id and password and/or SSL or TLS communications.

While the "built in" email API (QtmmSendMail) and commands built around them struggle with SSL and authentication, MAILTOOL (with MAILTOOL Plus) does not, mainly because we ourselves use Google as our email provider and we required a solution for our own applications.

Setting up email to work with these providers can be done one of two ways:

  • Command Interface - This method uses the Change Command Default (CHGCMDDFT) command to set the defaults for the MAILTOOL (and SPL2EMAIL if applicable) parameters that deal with the new mail router
  • Configuration Files - using configuration files these settings can be also configured globally or on a per user basis.

The information you will need for setup for either case will be as follows:

  • The outgoing SMTP server name.  For GMail it's normally smtp.gmail.com and for Outlook 365 it's normally smtp.office365.com. 
  • The type of secure connection that is used.  This will normally be either SSL or TLS
  • The port to use.  For SSL this is normally 465 and for TLS 587.
  • Is authentication required?  This means, do you need to specify a user id and password when sending emails?
  • Do you have the appropriace Certificate Authorities (CAs) installed?  If this is your first time setting up, most likely not.  You can download the appropriate CAs and install them following these instructions:

If you're using a PC email client to send emails then all of this information should already be set up in the application.  So that is a good place to start when finding this information.

Command Interface

If you mainly use the MAILTOOL command then setting things up is as easy as changing the defaults for the appropriate parameters so that your new mail router will use the proper settings.  The Change Command Default (CHGCMDDFT) command is used as follows:

CHGCMDDFT CMD(MAILTOOL) NEWDFT('SENDWITH(*MAILTOOL)')
CHGCMDDFT CMD(MAILTOOL) NEWDFT('MAILRTR(smtp.gmail.com)')
CHGCMDDFT CMD(MAILTOOL) NEWDFT('USERTR(*ONLY)')
CHGCMDDFT CMD(MAILTOOL) NEWDFT('SSL(*YES)')
CHGCMDDFT CMD(MAILTOOL) NEWDFT('PORT(465)')

The above example would be used for GMail.  The following example would be used for Outlook 365:

CHGCMDDFT CMD(MAILTOOL) NEWDFT('SENDWITH(*MAILTOOL)')
CHGCMDDFT CMD(MAILTOOL) NEWDFT('MAILRTR(smtp.office365.com)')
CHGCMDDFT CMD(MAILTOOL) NEWDFT('USERTR(*ONLY)')
CHGCMDDFT CMD(MAILTOOL) NEWDFT('SSL(*TLS)')
CHGCMDDFT CMD(MAILTOOL) NEWDFT('PORT(587)')

If your server requires authentication then you will need to supply the user and password on the MAILTOOL command at run time.  

Configuration Files

With the latest version of MAILTOOL configuration files can be used at the global level or the user level.  

Our advice is to first change the global default configuration file so that the appropriate information is there for the server, port and SSL mode.  

...
	{
		"name":"send_with_server_type",
		"default":"*MAILTOOL"
	},
	{
		"name":"mail_router",
		"default":"smtp.gmail.com"
	},
	{
		"name":"use_mail_router",
		"default":"*ONLY"
	},
	{
		"name":"use_ssl",
		"default":"*YES"
	},
	{
		"name":"smtp_port",
		"default":"465"
	},
...

Then, when you copy the configuration for new users all that needs to be changed is the user id and password information in their configuration file.  It also lets you set the default "from" address and name so it can match the user id and password information:

...
	{
		"name":"from_email",
		"default":"mikebrewer@wheelerdealers.com"
	},
	{
		"name":"from_name",
		"default":"Mike Brewer"
	},	{
		"name":"smtp_auth_user",
		"default":"mikebrewer@wheelerdealers.com"
	},
	{
		"name":"smtp_auth_password",
		"default":"tattyshiftknob"
	},
...

Feel free to contact us if you require any extra help or support.


Last edited 11/07/2016 at 11:26:04


Reply




Copyright 1983-2017 BVSTools
GreenBoard(v3) Powered by the eRPG SDK, MAILTOOL Plus!, GreenTools for Google Apps, jQuery, jQuery UI, BlockUI, CKEditor and running on the IBM i (AKA AS/400, iSeries, System i).