Jump to content

Recommended Posts

Posted (edited)

I'm setting up a quick AutoIt crash indicator to email me when AutoIt crashes... But the below code....

#Include<file.au3>

$s_SmtpServer = "smtp.gmail.com"         
$s_FromName = "Binarybrotherauto"                
$s_FromAddress = "**"
$s_ToAddress = "**" 
$s_Subject = "AutoIt Crashed"            
$as_Body = "AutoIt seems to have crashed."                          
$s_AttachFiles = ""              
$s_CcAddress = "" 
$s_BccAddress = ""  
$s_Username = "**"                  
$s_Password = "*********"            
$IPPort = 465                           
$ssl = 0                             
                            

Global $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
$rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl)
If @error Then
    MsgBox(0, "Error sending message", "Error code:" & @error & " Rc:" & $rc)
EndIf
;

Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "",$IPPort=25, $ssl=0)
    $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])
            If FileExists($S_Files2Attach[$x]) Then
                $objEmail.AddAttachment ($S_Files2Attach[$x])
            Else
                $i_Error_desciption = $i_Error_desciption & @lf & 'File not found to attach: ' & $S_Files2Attach[$x]
                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
    $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
; Sent the Message
    $objEmail.Send
    if @error then
        SetError(2)
        return $oMyRet[1]
    EndIf
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

Give me these...

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\Administrator\My Documents\send mail.au3"  
### COM Error ! Number: 800401F3 ScriptLine: 27 Description:
### COM Error ! Number: 000000A9 ScriptLine: 28 Description:
### COM Error ! Number: 000000A9 ScriptLine: 29 Description:
### COM Error ! Number: 000000A9 ScriptLine: 34 Description:
### COM Error ! Number: 000000A9 ScriptLine: 38 Description:
### COM Error ! Number: 000000A9 ScriptLine: 53 Description:
### COM Error ! Number: 000000A9 ScriptLine: 54 Description:
### COM Error ! Number: 000000A9 ScriptLine: 55 Description:
### COM Error ! Number: 000000A9 ScriptLine: 58 Description:
### COM Error ! Number: 000000A9 ScriptLine: 59 Description:
### COM Error ! Number: 000000A9 ScriptLine: 60 Description:
### COM Error ! Number: 000000A9 ScriptLine: 66 Description:
### COM Error ! Number: 000000A9 ScriptLine: 68 Description:
>Exit code: 0   Time: 3.571

A message box also appears with

| Error Sending Message |
                     error code:2 rc:

Thanks in advance for your assistance. :D

Edited by BinaryBrother

SIGNATURE_0X800007D NOT FOUND

Posted

hi,

is the port 465 the correct? Attempts times port 25

$s_SmtpServer = "smtp.gmail.com"

$s_FromName = "Binarybrotherauto"

$s_FromAddress = "binarybrotherauto@gmail.com"

$s_ToAddress = "binarybrother@gmail.com"

$s_Subject = "AutoIt Crashed"

$as_Body = "AutoIt seems to have crashed."

$s_AttachFiles = ""

$s_CcAddress = ""

$s_BccAddress = ""

$s_Username = "binarybrotherauto@gmail.com"

$s_Password = "*********"

$IPPort = 465

$ssl = 0

  • Developers
Posted (edited)

Is correct. Gmail is different :D

I assume that SSL should be 1 when using port 465 :P

.. but I think you need to check your CDO setup. Just search on google for:

CDO 800401F3
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 assume that SSL should be 1 when using port 465 :D

.. but I think you need to check your CDO setup. Just search on google for:

CDO 800401F3
By what I've gathered CDO is some sort of replacement mailing service for 'CDONTS' in a server machine (Windows Server), serving these pages via ASP or similar. Most suggest reformatting the code, or upgrading from 'CDONTS' to 'CDO'. I have no clue about ASP-etc. :P Maybe I mis-interpreted you...

SIGNATURE_0X800007D NOT FOUND

  • Developers
Posted

By what I've gathered CDO is some sort of replacement mailing service for 'CDONTS' in a server machine (Windows Server), serving these pages via ASP or similar. Most suggest reformatting the code, or upgrading from 'CDONTS' to 'CDO'. I have no clue about ASP-etc. :D Maybe I mis-interpreted you...

As far as I know it should be available on any standard XP machine with IE5 or better.. (didn't verify this to make sure)

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

  • 3 years later...
Posted

As far as I know it should be available on any standard XP machine with IE5 or better.. (didn't verify this to make sure)

Yes . The scripts only works with WinXP. I have tried in Windows 7 and got the below Error Msg. Is there any alternative for this script to send email.

### COM Error ! Number: 80020009 ScriptLine: 44 Description:The requested body part was not found in this message.

### COM Error ! Number: 80020009 ScriptLine: 45 Description:The requested body part was not found in this message.

### COM Error ! Number: 80020009 ScriptLine: 50 Description:The requested body part was not found in this message.

  • Developers
Posted

Yes . The scripts only works with WinXP. I have tried in Windows 7 and got the below Error Msg. Is there any alternative for this script to send email.

### COM Error ! Number: 80020009 ScriptLine: 44 Description:The requested body part was not found in this message.

### COM Error ! Number: 80020009 ScriptLine: 45 Description:The requested body part was not found in this message.

### COM Error ! Number: 80020009 ScriptLine: 50 Description:The requested body part was not found in this message.

Works fine for me on OS:WIN_7/ CPU:X64 OS:X64.

Show the script without account info that I can have a look at and test with on my Win7 box.

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

  • 2 years later...
Posted (edited)

Hi ,

I have tried doing as suggested in the above transcripts and from other threads in this forum ie. compile the exe for x64, however I am getting the following error:

 

2013-08-30 12:23:14 : ### COM Error ! Number: 800401F3 ScriptLine: -1 Description:
2013-08-30 12:23:14 : ### COM Error ! Number: 000000A9 ScriptLine: -1 Description:

 

OS: 64Bit Windows Server 2008 Std. with Exchange server.

CDO version :CDOEX

While using the 32Bit compiled exe I am getting 8002801D

Any ideas?

Edited by DeltaRocked
Posted

HRESULT: 0x800401F3 (CO_E_CLASSSTRING) means that a required component isn't installed.

CDO is no longer supported by MS.

I will search for some MS links describing the problem ...

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

Hi Water,

Thanks for the input. upon further investigation, MS2008 server with MS Exchange requires  MAPI/CDO libraries / MS Outlook to be installed. I have asked my support staff to do the needful at the client's place and will revert back in next 48 hours.

Hopefully this should resolve the issue.

The Link:

http://theessentialexchange.com/blogs/michael/archive/2008/06/05/mapi-cdo-for-windows-server-2008-and-windows-vista.aspx

However the MAPI/CDO download link mentioned in the article is broken.

Regards

Deltarocked.

Posted

Does this link work?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

If you can't install CDO on the server I would suggest to use Blat to send the mails. It's a standalone program that even can be packed (FileInstall) with the AutoIt script.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

Hi water,

blat is the last option, however for testing purpose I cannot play around with the live prod. hence first the test server and then on to prod server. whatever be the outcome will revert back.

Regards

Posted

Hi.

IMHO blat is the *BEST* option. Simply works ;) and one single file install doesn't harm

Regards, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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