Running AHFCTL Commands to Manage EMail Configuration for All AHF Tools

ahfctl setsmtp

Use the ahfctl setsmtp command to set the SMTP mail configuration parameters.

Syntax

ahfctl setsmtp
[-h]
[-debug]
[-all]
[-host HOST]
[-user USER]
[-password]
[-from FROM]
[-to TO]
[-port PORT]
[-cc CC]
[-bcc BCC]
[-ssl SSL]
[-auth AUTH]

Parameters

ahfctl setsmtp Command Parameters

ParameterDescription
-debugSpecify the -debug option to enable debugging.
-allSpecify to set all smtp parameters.
-host HOSTSpecify the name of the SMTP server, for example, smtphostname.
-user USERSpecify the name of the SMTP user, for example, smtpuser.
-passwordSpecify the password of the SMTP user.
-from FROMSpecify the email address of the sender.
-to TOSpecify the email address of the recipient.
-port PORTSpecify the port of the SMTP server, for example, 44.
-cc CCSpecify the CC email address.
-bcc BCCSpecify the BCC email address.
-ssl SSLSpecify true to enable SSL and false to disable SSL. Default: false .
-auth AUTHSpecify true to enable SMTP authentication and false to disable SMTP authentication. Default: false.

Example ahfctl setsmtp

To set all the SMTP parameters:

ahfctl setsmtp -user smtpuser -from ahfteam@example.com -to touser@example.com -port 24 -password

To set only the to email address:

ahfctl setsmtp -to toaddress@example.com

If you see the Parameter smtp.to is already set message, then run the unsetsmtp command to clear the existing smtp.to configuration followed by the setsmtp command to configure smtp.to anew.

ahfctl setsmtp -to 
Parameter smtp.to is already set
ahfctl unsetsmtp -to
Unset SMTP parameters completed successfully.
ahfctl setsmtp -to <email>
Set SMTP parameters completed successfully.

ahfctl getsmtp

Use the ahfctl getsmtp command to query the SMTP mail configuration parameters.

Syntax

ahfctl getsmtp
[-h]
[-debug]
[-all]
[-host]
[-user]
[-password]
[-from]
[-to]
[-port]
[-cc]
[-bcc]
[-ssl]
[-auth]

Parameters

ahfctl getsmtp Command Parameters

ParameterDescription
-debugSpecify to query if debugging is enabled or not
-allSpecify to query all smtp parameters.
-host HOSTSpecify to query the name of the SMTP server.
-user USERSpecify to query the name of the SMTP user,
-passwordSpecify to query the password of the SMTP user.
-from FROMSpecify to query the email address of the sender.
-to TOSpecify to query the email address of the recipient.
-port PORTSpecify to query the port of the SMTP server.
-cc CCSpecify to query the CC email address.
-bcc BCCSpecify to query the BCC email address.
-ssl SSLSpecify to query if SSL is enabled or not.
-auth AUTHSpecify to query if authentication is enabled or not.

Example ahfctl getsmtp

To query all of the SMTP parameters:

ahfctl getsmtp -all

To query the SMTP server configuration for from email address:

ahfctl getsmtp -to

ahfctl checksmtp

Use the ahfctl checksmtp command to check the stored SMTP mail configuration parameters.

Syntax

ahfctl checksmtp
[-h]
[-debug]
[-to TO]
[-attachment ATTACHMENT]

Parameters

ahfctl checksmtp Command Parameters

ParameterDescription
-debugSpecify to check if debugging is enabled or not.
-to TOSpecify to check the email address of the recipient.
-attachment ATTACHMENTSpecify to check the mail attachment, for example, ahf_report.log.

Example ahfctl checksmtp

To check the stored SMTP parameters:

ahfctl checksmtp

To check the stored SMTP parameters with the specified recipient email address:

ahfctl checksmtp -to toaddress@example.com

ahfctl unsetsmtp

Use the ahfctl unsetsmtp command to unset the SMTP mail configuration parameters that you have set. AHF is installed with default SMTP configurations. You can use the ahfctl unsetsmtp command to unset these default parameters as well.

Syntax

ahfctl unsetsmtp
[-h]
[-debug]
[-all]
[-host]
[-user]
[-password]
[-from]
[-to]
[-port]
[-cc]
[-bcc]
[-ssl]
[-auth]

Parameters

ahfctl unsetsmtp Command Parameters

ParameterDescription
-debugSpecify the -debug option to enable debugging.
-allSpecify to unset all smtp parameters and the default SMTP mail configuration parameters as well.
-hostSpecify the name of the SMTP server to unset.
-userSpecify the name of the SMTP user to unset.
-passwordSpecify the password of the SMTP user to unset.
-fromSpecify the email address of the sender to unset.
-toSpecify the email address of the recipient to unset.
-portSpecify the port of the SMTP server to unset.
-ccSpecify the CC email address to unset.
-bccSpecify the BCC email address to unset.
-sslSpecify to unset SSL configuration.
-authSpecify to unset auth configuration.

Examples ahfctl unsetsmtp

To unset all of the SMTP parameters

ahfctl unsetsmtp -all

To unset the from parameter:

ahfctl unsetsmtp -from

ahfctl sendmail

Use the ahfctl sendmail command to send a test email to verify SMTP configuration.

Syntax

ahfctl sendmail
[-h]
[-to TO]
[-cc CC]
[-bcc BCC]
[-subject SUBJECT]
[-body BODY]
[-attachment ATTACHMENT]
ParameterDescription
-to TOSpecify the recipient email address.
-cc CCSpecify the email address to send a carbon copy of the email.
-bcc BCCSpecify the email address to send a blind carbon copy of the email
-subject SUBJECTSpecify to add email subject.
-body BODYSpecify to add body of the email.
-attachment ATTACHMENTSpecify to add an attachment.

Examples

  • To send an email to recipients with default/set parameters:

    ahfctl sendmail
  • To send an email with attachment:

    ahfctl sendmail -to toaddress@company.com -attachment <path_to_file>
    ahfctl sendmail -to $ORACLE_USER@oracle.com -attachment /tmp/test_email.log
    Mail has sent successfully to  oradb@oracle.com