drifter213

Sending mails error

4 posts in this topic

Hey guys, I am currently trying to send a mail with an AutoIT script

Code:

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

Local $s_SmtpServer = "smtp.gmail.com"
Local $s_FromName = "TEST"
Local $s_FromAddress = "*@gmail.com"
Local $s_ToAddress = "*@gmail.com"
Local $s_Subject = "TEST"
Local $as_Body[2]
$as_Body[0] = "Testmail"
$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

But I am getting this error:

0PLOc.jpg

What am I doing wrong?

Share this post


Link to post
Share on other sites



Gmail is using secure SMTP so the regular  _INetSmtpMail() will not work. Search the forum  for  _INetSmtpMailCom() which will work.

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
3 hours ago, Jos said:

Gmail is using secure SMTP so the regular  _INetSmtpMail() will not work. Search the forum  for  _INetSmtpMailCom() which will work.

Jos

Thanks for you reply!

I tried to use your _INetSmtpMail() script form here: 

Now I am getting this error msg;

RrOWc.jpg

I have edited only this part:

;##################################
; Variables
;##################################
$SmtpServer = "smtp.gmail.com"              ; address for the smtp-server to use - REQUIRED
$FromName = "Test"                      ; name from who the email was sent
$FromAddress = "*@gmail.com" ; address from where the mail should come
$ToAddress = "*@gmail.com"   ; destination address of the email - REQUIRED
$Subject = "TESTMAIL"                   ; subject from the email - can be anything you want it to be
$Body = "TESTMAIL"                              ; the messagebody from the mail - can be left blank but then you get a blank mail
$AttachFiles = ""                       ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed
$CcAddress = ""       ; address for cc - leave blank if not needed
$BccAddress = ""     ; address for bcc - leave blank if not needed
$Importance = "Normal"                  ; Send message priority: "High", "Normal", "Low"
$Username = "*@gmail.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
$IPPort = 465                            ; port used for sending the mail
$ssl = 1                                ; enables/disables secure socket layer sending - put to 1 if using httpS
;~ $IPPort=465                          ; GMAIL port used for sending the mail
;~ $ssl=1                               ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS

 

Share this post


Link to post
Share on other sites

Just tried another provider and there it is working... I don't need help with this anymore, thanks for your script! :D

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