Send email: Difference between revisions
Content added Content deleted
No edit summary |
(SQL PL in Db2) |
||
Line 1,250: | Line 1,250: | ||
Howdy from a python function |
Howdy from a python function |
||
</pre> |
</pre> |
||
=={{header|SQL PL}}== |
|||
{{works with|Db2 LUW}} version 9.7 or higher. |
|||
With SQL PL: |
|||
You must first set the SMTP server in the database from which you want to send the message. |
|||
<lang SQL PL> |
|||
UPDATE DB CFG FOR myDb USING SMTP_SERVER 'smtp.ibm.com'; |
|||
CALL UTL_MAIL.SEND ('senderAccount@myDomain.com','recipientAccount@yourDomain.com', NULL, NULL, 'The subject of the message', 'The content of the message'); |
|||
</lang> |
|||
Output: |
|||
<pre> |
|||
db2 => UPDATE DB CFG FOR myDb USING SMTP_SERVER 'smtp.ibm.com'; |
|||
DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully. |
|||
db2 => CALL UTL_MAIL.SEND ('senderAccount@myDomain.com','recipientAccount@yourDomain.com', NULL, NULL, 'The subject of the message', 'The content of the message'); |
|||
Return Status = 0 |
|||
</pre> |
|||
If you receive a "SQL1336N The remote host "smtp.ibm.com" was not found. SQLSTATE=08001" message, it is because the SMTP_SERVER is not valid. |
|||
More information in the [https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.apdv.sqlpl.doc/doc/r0055177.html IBM Knowledge center] |
|||
=== Windows === |
=== Windows === |