Jump to content

Error code 4 when trying to send EMail


Recommended Posts

#include <Inet.au3>
#include <MsgBoxConstants.au3>

Local $s_SmtpServer = "smtp.gmail.com"
Local $s_FromName = "Teest"
Local $s_FromAddress = "FROM@EMAIL.com"
Local $s_ToAddress = "TO@EMAIL.com" 
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

Whenever I run this I get error code 4

I also don't understand how this doesn't need a password for the emailing that's sending it

Link to comment
Share on other sites

  • Developers

Use _InetSmtpMailCom() from the examples forum as the standard UDF can't send secure SMTP. This have been asked many times already. :)

Jos

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.
  :)

Link to comment
Share on other sites

2 hours ago, Jos said:

Use _InetSmtpMailCom() from the examples forum as the standard UDF can't send secure SMTP. This have been asked many times already. :)

Jos

Fair enough! I think you should be that should be mentioned inside the Help File :P

Link to comment
Share on other sites

  • Developers

Helpfile is clear that the _InetSmtpMail() sends an SMTP message. Gmail doen't use SMTP but Authenticated SMTP, which is something totally different.
I have never spent the time to make this an official UDF but have neither stopped anyone from doing so. ;)

Jos

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.
  :)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...