VI. Feature Setup

Use Gmail to send Mail Alerts from a DrayTek Router

Products:
Vigor 2620Ln
Vigor 2760
Vigor 2762
Vigor 2765
Show all

Keywords:
Gmail
Notification
SMTP
WAN
Show all

How can I use a Gmail account to send Mail Alerts from a DrayTek Router?

Sending Mail Alerts from a router is a great way to get notifications of network problems and log when faults have occurred.
DrayTek routers have extensive mail alert facilities, which are configurable to send email alerts for WAN drop / reconnection events, VPN tunnels that fail to reconnect, as well as security events, such as logging into the router, or making changes to its configuration.

Google's Gmail accounts can be used with DrayTek's mail alert facilities as a convenient way to have the router send mail without setting up an SMTP server to send those emails.

Google's security for Gmail accounts does require some additional steps though - it's not possible to simply put your Gmail credentials into the router's Mail Server settings. Instead, the Google Account must be configured with an App Password, which is a simplified method for devices to use the Google account for sending mail and other services.

Setting up an App Password for a Google Account

To begin, go to https://myaccount.google.com and log in to the Google account that will be used for sending mail.

From the Google Account page, head to the Security section:

Accessing Google Accounts Portal

In the Security menu, scroll down to the Signing in to Google options, then go into App passwords:

Creating an App Password

This may then trigger another password verification. Make sure to select the correct account from the drop down list and re-enter the password:

Verify Google Password

The App passwords section gives options to select the app, or device, that you'll be creating new credentials for. This is mostly for identification purposes.

Expand the Select app drop down, then select Other (Custom name):

Naming the App Password 1

With the app of "Other (Custom name)" selected, a text box will appear and the identifier for the router can now be entered.

In this example, a DrayTek Vigor 2865 router is used. Click on Generate to create the App password:

Naming the App Password 2

Once an App password is generated, the password will display on the screen in plain text as shown below. Make sure to note this password as it's needed to enter into the router later.

This password can give full access to your Google account, so ensure that it's cleared, deleted or destroyed, once it's been entered into the router.
With the App password now generated, the next step is to configure the DrayTek router to use this password.

App Password Created


Configure a Mail Server Profile on the DrayTek Router

Access the router's web interface and go to [Objects Setting] > [SMS / Mail Service Object] to begin setting up the Mail account.

On that page, click on the Mail Server tab and then select the first un-used profile to configure it:

Router WUI - Objects - Mail Service Object

In the Mail Service profile, enter these details to send mail from a Gmail account:

Setting Value Description
Profile Name Gmail An identifier for the Mail Server profile in the router's Web Interface
Interface Any This defines which WAN interface can be used to send email with this profile. This can be left as 'Any'
SMTP Server smtp.gmail.com The SMTP server that the router will contact to send mail
SMTP Port 587 This SMTP port that the router will attempt to use to send mail. Port 587 is used for StartTLS.
On some older routers that don't support this, it may be necessary to specify 465 and use SSL Connection Security.
Sender Address your email address @gmail.com Enter the email address for the Gmail account
Connection Security StartTLS - Force StartTLS The security that the router will use to send mail. Setting the router to "Accept using plain text" will reduce security and may not be supported by Gmail
Authentication Ticked Enable this to provide a username and password when sending mails
Username your email address @gmail.com Enter the email address for the Gmail account
Password <App password>
Enter the App password that was just created in the Google Account settings
Sending Interval 90 (recommended) Setting this to a lower value means that the router may send more emails, but will give more detailed logs.
For example if a WAN disconnects and then reconnects within 90 seconds, the router will only send one email to notify of the disconnection & reconnection, rather than two.

Creating a Mail Server profile for Gmail

With all of those details entered, click OK to save the profile and go back to the list of Mail Service profiles.

You can optionally send a test mail with these details. To do that, either go back into the profile and click Send a Test E-mail to start.
Or before clicking OK to save, click on test email and that will save the profile, then perform the mail test:

Sending a test email 1

Click OK, then enter the email address that the router will send the test email to:

Sending a test email 2

Within a few seconds, your inbox should show the test message, which will indicate the router model that sent the test message.

Once that's working, proceed to set up what the router should send notifications for.

Setting up Notification Objects

Notification objects are used by the router to define which settings to send email or SMS alerts for. Different Notification profiles can be applied to different email addresses and phone numbers if there are multiple administrators, or different types of alert that should go via SMS or email.

To set up a profile, go to [Objects Setting] > [Notification Object] and select an un-used profile:

Creating a Notification Object

In the Notification Object profile, specify a name and select the options that you want the router to send alerts for. In this example, only WAN disconnection, reconnection and WAN budget limit are selected. Click OK to save the profile when done.

Configuring the Notification Object

Now the email address that the router will send notifications to, can be configured. To set that up, go to [Application] > [SMS / Mail Alert Service] and click on the Mail Alert tab.

To send to a single address, enable one of the ten possible addresses and configure these settings:

Setting Value Description
Enable Ticked Enable an index to enable emails to be sent to the specified email address. Potentially the router can notify 10 addresses, each for different notification events.
Mail Service 1 - Gmail Select the Gmail profile that was created earlier.
Mail Address recipient address @example.com Enter the intended recipient of the router's email alerts.
Notify Profile WAN Change Select the Notify Profile that was created and the router will notify only for the options specified in that profile.
Schedule 3-workdays Select a schedule entry if you want emails to send only during the specified time window. This can be useful if there are only set hours that certain technicians are available.
Another common scenario would be if using SMS alerts, you could set the router to only send text messages during the day and evening, rather than notifying of issues overnight,

Defining which email addresses are alerted of problems

Click OK when done to save and apply Mail Alerts from the router. From this point, the router will send an email for any events that match the notification profile to each specified email address.

Testing Mail Alerts

To check whether this is working as expected, it can be helpful to trigger an event, such as unplugging a WAN cable to test whether the router sends alerts as expected. In this example, WAN1 was unplugged from the Vigor 2865 router. There was no secondary WAN for the router to use while WAN1 was down, so the email was sent once the router reconnected to the Internet.

If there's no secondary connection for either Failover or Load Balance that the router can use to notify, email and SMS alerts can only be sent once the primary WAN is re-established. If there is a secondary WAN, the router can send out an email alert immediately to notify of a WAN failure event.

Example of WAN Disconnect Mail Alert


How do you rate this article?

1 1 1 1 1 1 1 1 1 1