Dgameman1

Error code 4 when trying to send EMail

4 posts in this topic

#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

Share this post


Link to post
Share on other sites



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

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

1 person likes this

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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