Configure Email Notification

Configure the SMTP feature to generate email notifications for component failures, critical conditions, or general system health status.

About this task

The SMTP feature is disabled by default.

Before you begin

  • To identify the SMTP server by hostname, you must first configure a DNS client on the switch.

Procedure

  1. Enter Global Configuration mode:

    enable

    configure terminal

  2. Configure the TCP port the client uses to open a connection with the SMTP server:

    smtp port <1–65535>

    Note

    Note

    The port you specify must match the port that the SMTP server uses.

  3. Configure email recipients:

    smtp receiver-email add WORD<3-1274>

    smtp receiver-email remove WORD<3-1274>

    Note

    Note

    You must configure at least one recipient.

  4. Configure the SMTP server hostname or IPv4 address:

    smtp server WORD<1-256>

  5. Optional: Configure a sender email address:

    smtp sender-email WORD<3-254>

  6. Optional: Add or remove log events to the default list that generate email notification:

    smtp event-id add WORD<1-1100>

    smtp event-id remove WORD<1-1100>

  7. Optional: Configure the status update interval:

    smtp status-send-timer <0 | 30-43200>

  8. Enable the SMTP client:

    smtp enable

  9. Configure an SMTP domain name:

    smtp domain-name WORD<1–254>

  10. Verify the configuration:

    show smtp [event-id]

Examples

Configure the SMTP client to use TCP port 26 to communicate with an SMTP server that is using port 26. Add two receiver email addresses, configure the server information using an IPv4 address, and enable the SMTP feature. Finally, configure an SMTP domain name, and then verify the configuration.

Switch:1>enable
Switch:1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Switch:1(config)#smtp port 26
Switch:1(config)#smtp receiver-email add test1@default.com,test2@default.com
Switch:1(config)#smtp server 192.0.2.1 
Switch:1(config)#smtp enable 
Switch:1(config)#smtp domain-name test mailer
Switch:1(config)#show smtp
================================================================================
                                SMTP Information
================================================================================
        SMTP Status:  Enabled
     Server Address:  192.0.2.1
        Server Port:  26
  Status send Timer:  30 (seconds)
       Sender Email:  LabSwitch@default.com
        Domain Name:  test mailer
    Receiver Emails:  test1@default.com
                      test2@default.com
                      

Add an event ID to the list for which the switch sends email notification on a log event. Verify the configuration.

Switch:1(config)#smtp event-id add 0x0000c5ec
Switch:1(config)#show smtp event-id
================================================================================
                           SMTP Event IDs Information
================================================================================
Log Event IDs: (total: 51) 
           0x000045e3,0x00004602,0x00004603,0x0000c5ec,0x000106ce,0x000106cf
           0x000106d0,0x000106d1,0x000106d2,0x000106d4,0x000106d8,0x000106d9
           0x000106da,0x000106f8,0x000106f9,0x000106fb,0x00010775,0x00010776
           0x000107f5,0x000107f6,0x000305c8,0x000305ca,0x000305f1,0x00030637
           0x00040506,0x00040507,0x00040508,0x00040509,0x000646da,0x000646db
           0x00088524,0x000d8580,0x000d8586,0x000d8589,0x000e4600,0x000e4601
           0x000e4602,0x000e4603,0x000e4604,0x000e4605,0x000e4606,0x000e4607
           0x000e4608,0x000e4609,0x001985a0,0x00210587,0x00210588,0x00210595
           0x00210596,0x0027458a,0x0027458d

Default Event IDs: (total: 50) 
           0x000045e3,0x00004602,0x00004603,0x000106ce,0x000106cf,0x000106d0
           0x000106d1,0x000106d2,0x000106d4,0x000106d8,0x000106d9,0x000106da
           0x000106f8,0x000106f9,0x000106fb,0x00010775,0x00010776,0x000107f5
           0x000107f6,0x000305c8,0x000305ca,0x000305f1,0x00030637,0x00040506
           0x00040507,0x00040508,0x00040509,0x000646da,0x000646db,0x00088524
           0x000d8580,0x000d8586,0x000d8589,0x000e4600,0x000e4601,0x000e4602
           0x000e4603,0x000e4604,0x000e4605,0x000e4606,0x000e4607,0x000e4608

           0x000e4609,0x001985a0,0x00210587,0x00210588,0x00210595,0x00210596
           0x0027458a,0x0027458d

Remove From Default: (total: 0) 

Add List: (total: 1) 
           0x0000c5ec

Variable Definitions

The following table defines parameters for the smtp port command.

Variable

Value

<1–65535>

Specifies the TCP port on the switch that the SMTP client uses to communicate with the SMTP server. The default value is 25.

Note:

You must disable the SMTP feature before you can change an existing SMTP port configuration.

The port you specify must match the port that the SMTP server uses.

The following table defines parameters for the smtp receiver-email command.

Variable

Value

add WORD<3-1274>

Adds an email address to the recipient list. The recipients receive the email notification generated by the switch.

You must configure at least one email recipient and can create a maximum of five email recipients. You can specify multiple addresses in a single command by separating them with a comma.

You cannot use quotation marks (“) or commas (,) in email addresses. Other restrictions for the format of the email address follow RFC 5321.

The maximum length for the address is 254 characters.

remove WORD<3-1274>

Removes an email address from the recipient list. The recipients receive the email notification generated by the switch. You can specify multiple addresses in a single command by separating them with a comma.

You cannot use quotation marks (“) or commas (,) in email addresses. Other restrictions for the format of the email address follow RFC 5321.

The maximum length for the address is 254 characters.

The following table defines parameters for the smtp server command.

Variable

Value

WORD<1-256>

Specifies the SMTP server address. You can use either a hostname or IPv4 address. If you use a hostname, you must configure the DNS client on the switch.

The following table defines parameters for the smtp sender-email command.

Variable

Value

WORD<3-254>

Specifies the email address that the system displays it in the From field of the message that the switch generates. By default, the switch uses <SystemName>@default.com.

The following table defines parameters for the smtp event-id command.

Variable

Value

add WORD<1-1100>

Adds a log event to the list of events that generate email notification. You can specify multiple event IDs in a single command by separating them with a comma.

The event ID can be up to 10 digits in hexadecimal format.

remove WORD<1-1100>

Removes a log event from the list of events that generate email notification. You can specify multiple event IDs in a single command by separating them with a comma.

The event ID can be up to 10 digits in hexadecimal format.

The following table defines parameters for the smtp status-send-timer command.

Variable

Value

<0 | 30-43200>

Specifies the interval, in seconds, at which the switch sends status information. The default is 30 seconds. A value of 0 means the switch does not send status information.

The following table defines parameters for the smtp domain-name command.

Variable

Value

WORD<1-254>

Specifies the SMTP host name or IPv4 address (string length 1–254).

The following table defines parameters for the show smtp command.

Variable

Value

event-id

Shows a list of active event IDs for which the switch generates email notification. The command output includes the default list of IDs and IDs you specifically add or remove.