User_1994 Posted December 30, 2020 Posted December 30, 2020 Hi all, I am trying to send a simple test email using the _INetSmtpMail() function but I am receiving "Mail failed with error code 50" message. Here is my code below (copied from the autoit page and modified variables): #include <Inet.au3> #include <MsgBoxConstants.au3> Local $s_SmtpServer = "outlook.office365.com" Local $s_FromName = "[My name]" Local $s_FromAddress = "[my office 365 email]" Local $s_ToAddress = "[my office 365 email]" Local $s_Subject = "My Test UDF" Local $as_Body[2] $as_Body[0] = "Testing the new email udf" $as_Body[1] = "Second Line" Local $iResponse = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body) Local $iErr = @error If $iResponse = 1 Then MsgBox($MB_SYSTEMMODAL, "Success!", "Mail sent") Else MsgBox($MB_SYSTEMMODAL, "Error!", "Mail failed with error code " & $iErr) EndIf I changed the name/email addresses for privacy. Thanks for any help.
Nine Posted December 30, 2020 Posted December 30, 2020 Check this : “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
User_1994 Posted December 30, 2020 Author Posted December 30, 2020 28 minutes ago, Nine said: Check this : Thank you so much! I was successfully able to use that code.
Nine Posted December 30, 2020 Posted December 30, 2020 All thanks goes to @Jos. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
User_1994 Posted December 30, 2020 Author Posted December 30, 2020 1 minute ago, Nine said: All thanks goes to @Jos. Thank you @Jos!
nend Posted December 30, 2020 Posted December 30, 2020 @User_1994 Did you get it to work with CDO? I looked everywhere and can find a good working solution to use CDO with office 365 mail (I only get CDO to work with port 25). I made a Autoit wrapper for the Swith Mail (Swith Mail is small standalone exe) and that worked perfect for me.
Developers Jos Posted December 30, 2020 Developers Posted December 30, 2020 The linked UDF does work fine for me with O356. I use these settings: $SmtpServer = "smtp.office365.com" ; address for the smtp-server to use - REQUIRED $FromName = "Jos" ; name from who the email was sent $FromAddress = "jos.....@outlook.com" ; address from where the mail should come $ToAddress = "jos.....@yahoo.com" ; destination address of the email - REQUIRED $Subject = "Test O365 message" ; subject from the email - can be anything you want it to be $Body = " test email" ; the messagebody from the mail - can be left blank but then you get a blank mail $AttachFiles = "" ; the file you want to attach- leave blank if not needed $CcAddress = "" ; address for cc - leave blank if not needed $Importance = "Normal" ; Send message priority: "High", "Normal", "Low" $BccAddress = "" ; address for bcc - leave blank if not needed $Username = "jos......@outlook.com" ; username for the account used from where the mail gets sent - REQUIRED $Password = "?????????" ; password for the account used from where the mail gets sent - REQUIRED $SmtpServer = "smtp.office365.com" ; address for the smtp-server to use - REQUIRED $IPPort=25 ; port used for sending the mail $ssl=1 ; enables/disables secure socket layer sending - put to 1 if using httpS Jos RickB75 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now