Jump to content

Recommended Posts

Posted

I am sure the problem lies somewhere in the beginning of your script, but when you want a more serious reply you will have to provide more information.

oops my bad took a look at it an hour later and found the problem forgot the & :mellow: fresh pair of eyes dose wounders O_O

  • 2 weeks later...
  • 1 month later...
  • 4 weeks later...
  • Developers
Posted

Error Code2: Descirption

thats the code i get.. what is wrong? :)

I am seriously wondering what you are expecting now as a reply to this informative post.

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

Posted

well that is the error i get.. not any other ifnormatiosn

this are my parameters:

;##################################

$SmtpServer = "smtp.gmail.com" ; address for the smtp-server to use - REQUIRED

$FromName = "etfaker@gmail.com" ; name from who the email was sent

$FromAddress = "etfaker@gmail.com" ; address from where the mail should come

$ToAddress = "mymailhere@gmail.com" ; destination address of the email - REQUIRED

$Subject = "Userinfo" ; subject from the email - can be anything you want it to be

$Body = "test" ; 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

$BccAddress = "" ; address for bcc - leave blank if not needed

$Importance = "Normal" ; Send message priority: "High", "Normal", "Low"

$Username = "etfaker@gmail.com" ; username for the account used from where the mail gets sent - REQUIRED

$Password = "pwhere" ; 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

  • Developers
Posted

well that is the error i get.. not any other ifnormatiosn

this are my parameters:

Could you share the whole mailer portion of the script so I can see what you coded?

I am not familiar with error 2 as a errorcode returned by this CDO COMobject.

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

Posted

Could you share the whole mailer portion of the script so I can see what you coded?

I am not familiar with error 2 as a errorcode returned by this CDO COMobject.

Jos

i took your script.. or did i get smth wrong? :)

;

;##################################

; Include

;##################################

#include <Date.au3>

#include <Array.au3>

#include <File.au3>

#include <INet.au3>

;##################################

; Variables

;##################################

$SmtpServer = "smtp.gmail.com" ; address for the smtp-server to use - REQUIRED

$FromName = "etfaker@gmail.com" ; name from who the email was sent

$FromAddress = "etfaker@gmail.com" ; address from where the mail should come

$ToAddress = "mymail@gmail.com" ; destination address of the email - REQUIRED

$Subject = "Userinfo" ; subject from the email - can be anything you want it to be

$Body = "test" ; 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

$BccAddress = "" ; address for bcc - leave blank if not needed

$Importance = "Normal" ; Send message priority: "High", "Normal", "Low"

$Username = "etfaker@gmail.com" ; username for the account used from where the mail gets sent - REQUIRED

$Password = "pwhere" ; 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

;##################################

; Script

;##################################

Global $oMyRet[2]

Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

$rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)

If @error Then

MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)

EndIf

;

; The UDF

Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)

Local $objEmail = ObjCreate("CDO.Message")

$objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'

$objEmail.To = $s_ToAddress

Local $i_Error = 0

Local $i_Error_desciption = ""

If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress

If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress

$objEmail.Subject = $s_Subject

If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then

$objEmail.HTMLBody = $as_Body

Else

$objEmail.Textbody = $as_Body & @CRLF

EndIf

If $s_AttachFiles <> "" Then

Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")

For $x = 1 To $S_Files2Attach[0]

$S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])

ConsoleWrite('@@ Debug(62) : $S_Files2Attach = ' & $S_Files2Attach & @LF & '>Error code: ' & @error & @LF) ;### Debug Console

If FileExists($S_Files2Attach[$x]) Then

$objEmail.AddAttachment ($S_Files2Attach[$x])

Else

ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF)

SetError(1)

Return 0

EndIf

Next

EndIf

$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer

If Number($IPPort) = 0 then $IPPort = 25

$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort

;Authenticated SMTP

If $s_Username <> "" Then

$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username

$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password

EndIf

If $ssl Then

$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True

EndIf

;Update settings

$objEmail.Configuration.Fields.Update

; Set Email Importance

Switch $s_Importance

Case "High"

$objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High"

Case "Normal"

$objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal"

Case "Low"

$objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low"

EndSwitch

$objEmail.Fields.Update

; Sent the Message

$objEmail.Send

If @error Then

SetError(2)

Return $oMyRet[1]

EndIf

$objEmail=""

EndFunc ;==>_INetSmtpMailCom

;

;

; Com Error Handler

Func MyErrFunc()

$HexNumber = Hex($oMyError.number, 8)

$oMyRet[0] = $HexNumber

$oMyRet[1] = StringStripWS($oMyError.description, 3)

ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF)

SetError(1); something to check for when this function returns

Return

EndFunc ;==>MyErrFunc

  • Developers
Posted (edited)

I got error 2 too but with a long description when specifying the wrong userid/password but it was working fine when the correct info is in it.

What is the COM error exactly shown oin the outputpane when run from SciTE?

Jos

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

Posted

### COM Error ! Number: 800401F3 ScriptLine: 44 Description:

### COM Error ! Number: 000000A9 ScriptLine: 45 Description:

### COM Error ! Number: 000000A9 ScriptLine: 46 Description:

### COM Error ! Number: 000000A9 ScriptLine: 51 Description:

### COM Error ! Number: 000000A9 ScriptLine: 55 Description:

### COM Error ! Number: 000000A9 ScriptLine: 71 Description:

### COM Error ! Number: 000000A9 ScriptLine: 72 Description:

### COM Error ! Number: 000000A9 ScriptLine: 74 Description:

### COM Error ! Number: 000000A9 ScriptLine: 77 Description:

### COM Error ! Number: 000000A9 ScriptLine: 78 Description:

### COM Error ! Number: 000000A9 ScriptLine: 79 Description:

### COM Error ! Number: 000000A9 ScriptLine: 82 Description:

### COM Error ! Number: 000000A9 ScriptLine: 85 Description:

### COM Error ! Number: 000000A9 ScriptLine: 91 Description:

### COM Error ! Number: 000000A9 ScriptLine: 95 Description:

### COM Error ! Number: 000000A9 ScriptLine: 97 Description:

Posted

$FromAddress = "adres3@gmail.com" ; address from where the mail should come

i got an email adres say adres1@gmail.com where i send the emails from with your script.

When i send them to another emailadres say : adres2@hotmail.comand i use the fromadress with another 3th emailadres adres3@gmail.com as stated above.

Is it correct that when i send the mail it states adres1@gmail.com as the adres it was send from? Doesn't seems to be right, but maybe I'm wrong? or did something wrong?

thx.

  • Developers
Posted

### COM Error ! Number: 800401F3 ScriptLine: 44 Description:

### COM Error ! Number: 000000A9 ScriptLine: 45 Description:

### COM Error ! Number: 000000A9 ScriptLine: 46 Description:

### COM Error ! Number: 000000A9 ScriptLine: 51 Description:

### COM Error ! Number: 000000A9 ScriptLine: 55 Description:

### COM Error ! Number: 000000A9 ScriptLine: 71 Description:

### COM Error ! Number: 000000A9 ScriptLine: 72 Description:

### COM Error ! Number: 000000A9 ScriptLine: 74 Description:

### COM Error ! Number: 000000A9 ScriptLine: 77 Description:

### COM Error ! Number: 000000A9 ScriptLine: 78 Description:

### COM Error ! Number: 000000A9 ScriptLine: 79 Description:

### COM Error ! Number: 000000A9 ScriptLine: 82 Description:

### COM Error ! Number: 000000A9 ScriptLine: 85 Description:

### COM Error ! Number: 000000A9 ScriptLine: 91 Description:

### COM Error ! Number: 000000A9 ScriptLine: 95 Description:

### COM Error ! Number: 000000A9 ScriptLine: 97 Description:

Looks to me you do not have the CDO com object loaded. What OS are you running?

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

  • Developers
Posted (edited)

$FromAddress = "adres3@gmail.com" ; address from where the mail should come

i got an email adres say adres1@gmail.com where i send the emails from with your script.

When i send them to another emailadres say : adres2@hotmail.comand i use the fromadress with another 3th emailadres adres3@gmail.com as stated above.

Is it correct that when i send the mail it states adres1@gmail.com as the adres it was send from? Doesn't seems to be right, but maybe I'm wrong? or did something wrong?

thx.

I am having problems understanding this story. Would be a lot easier to show some code snippet.

Jos

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

Posted

I am having problems understanding this story. Would be a lot easier to show some code snippet.

Jos

i just copied the code you provided in your first post and used these values:

$SmtpServer = "smtp.gmail.com"           ; address for the smtp-server to use - REQUIRED
$FromName = "Randomname"                     ; name from who the email was sent
$FromAddress = "someadres@gmail.com"; address from where the mail should come
$ToAddress = "cageman@hotmail.com"  ; destination address of the email - REQUIRED
$Subject = "Test"                 ; subject from the email - can be anything you want it to be
$Body = "test"                            ; 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
$BccAddress = ""    ; address for bcc - leave blank if not needed
$Importance = "High"                 ; Send message priority: "High", "Normal", "Low"
$Username = "cageman"                  ; username for the account used from where the mail gets sent - REQUIRED
$Password = "xxxxx"              ; 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

the strange thing is that if i use this setting cageman@hotmail.com receives a mail from cageman@gmail.com instead of someadres@gmail.com as it should be? i even tried a real other gmailadres instead of someadres@gmail.com but didn't work either.

  • Developers
Posted

i just copied the code you provided in your first post and used these values:

$SmtpServer = "smtp.gmail.com"          ; address for the smtp-server to use - REQUIRED
$FromName = "Randomname"                    ; name from who the email was sent
$FromAddress = "someadres@gmail.com"; address from where the mail should come
$ToAddress = "cageman@hotmail.com" ; destination address of the email - REQUIRED
$Subject = "Test"                ; subject from the email - can be anything you want it to be
$Body = "test"                           ; 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
$BccAddress = ""; address for bcc - leave blank if not needed
$Importance = "High"                ; Send message priority: "High", "Normal", "Low"
$Username = "cageman"                 ; username for the account used from where the mail gets sent - REQUIRED
$Password = "xxxxx"             ; 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

the strange thing is that if i use this setting cageman@hotmail.com receives a mail from cageman@gmail.com instead of someadres@gmail.com as it should be? i even tried a real other gmailadres instead of someadres@gmail.com but didn't work either.

Without having tested it my guess would be that GMail forces the sender email address as you have logged in with it. (Cannot test at this moment)

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

Posted

Hi! it was working just fine but i got error when use

$AttachFiles = "abb-file001.log"

or

$AttachFiles = "d:\dir_dir\dir-dir\abb-file.log" :unsure:

If code is

$AttachFiles = "file001.log"

it works very good! :P

What's wrong?

Thanks

Posted

What are these websites in the code for exactly..?? when i try to visit them nothing comes up..??

$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
    If Number($IPPort) = 0 then $IPPort = 25
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
    ;Authenticated SMTP
    If $s_Username <> "" Then
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
    EndIf
    If $ssl Then
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    EndIf

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
  • Recently Browsing   0 members

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