Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Tcl) Send Email with hotmail.com, live.com, or outlook.comSee more SMTP ExamplesSend email using your Microsoft hotmail.com, live.com, or outlook.com account via the smtp.office365.com SMTP server. See the Guide for Creating an Application to Send Email from Hotmail.com, Live.com, or Outlook.com
load ./chilkat.dll # This example requires the Chilkat API to have been previously unlocked. # See Global Unlock Sample for sample code. set mailman [new_CkMailMan] CkMailMan_put_SmtpHost $mailman "smtp.office365.com" CkMailMan_put_SmtpPort $mailman 587 CkMailMan_put_StartTLS $mailman 1 # This could be your hotmail.com, live.com, or outlook.com account. CkMailMan_put_SmtpUsername $mailman "yourName@live.com" # Load the previously saved OAuth2 access token. set json [new_CkJsonObject] set success [CkJsonObject_LoadFile $json "qa_data/tokens/hotmail.json"] if {$success == 0} then { puts [CkJsonObject_lastErrorText $json] delete_CkMailMan $mailman delete_CkJsonObject $json exit } CkMailMan_put_OAuth2AccessToken $mailman [CkJsonObject_stringOf $json "access_token"] set email [new_CkEmail] # Note: If you send an email such as this, it can easily go to your Junk or Trash email folders. CkEmail_put_Subject $email "This is a test" CkEmail_put_Body $email "This is a test" # This could be your hotmail.com, live.com, or outlook.com account. CkEmail_put_From $email "My Hotmail Account <yourName@live.com>" set success [CkEmail_AddTo $email "Joe Example" "joe@example.com"] set success [CkMailMan_OpenSmtpConnection $mailman] if {$success != 1} then { puts [CkMailMan_lastErrorText $mailman] puts "ConnectFailReason = [CkMailMan_get_ConnectFailReason $mailman]" delete_CkMailMan $mailman delete_CkJsonObject $json delete_CkEmail $email exit } set success [CkMailMan_SmtpAuthenticate $mailman] if {$success != 1} then { puts [CkMailMan_lastErrorText $mailman] delete_CkMailMan $mailman delete_CkJsonObject $json delete_CkEmail $email exit } set success [CkMailMan_SendEmail $mailman $email] if {$success != 1} then { puts [CkMailMan_lastErrorText $mailman] delete_CkMailMan $mailman delete_CkJsonObject $json delete_CkEmail $email exit } CkMailMan_CloseSmtpConnection $mailman puts "Email Sent." delete_CkMailMan $mailman delete_CkJsonObject $json delete_CkEmail $email |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.