Jump to content

Smtp Mailer That Supports Html And Attachments.


Jos
 Share

Recommended Posts

  • Developers

@Deltarocked,

Can we just add these 2 lines to the standard udf without breaking anything of should it be a selectable option via an optional parameter?

Thanks,

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

Hi Jos,

A optional parameter with a default value, would be great .

Reasons:

1: By Default , the user who wants to send normal email need not worry.

2: When someone wants to send mail with character encoding then for them this option will serve less headaches. The only problem they need to solve is getting the encoding right.

>>Can we just add these 2 lines to the standard udf without breaking anything

Not so sure about that ( Tested this on ASCII English Charset mails and UTF-8 encoded chinese , russian, japanese and few others) , as all my generated mails are UTF-8 encoded and How CDO chooses the default CharSet is unknown to me - most probably using the system's default OS type.

The reason for Choosing UTF-8 was that I wanted to display different encodings in one single mail.

Image of the Output : http://i.imgur.com/yDpMIdd.jpg

(PS: Please dont ask for translation - I have no idea what they mean - all these charcters were picked up from spam mails)

My recent posts are all about character encoding - its a headache especally the ISO-2022-JP and similar ones.

Regards

Deltarocked.

Edited by DeltaRocked
Link to comment
Share on other sites

  • 3 weeks later...

Hi Jos,

When I run your script as shown below, I get the following error msg:

### COM Error !  Number: 80020009   ScriptLine: 88   Description:The transport failed to connect to the server.

But the $RC returned is "0". 

AND  I promptly and correctly receive the email I sent.

 

Using Gmail on Win7 x64.

What am I misunderstanding here??

#RequireAdmin
#include <_INetSmtpMailCom.au3>
;##################################
; Variables
;##################################
$SmtpServer = "smtp.gmail.com"          ; address for the smtp-server to use - REQUIRED
$FromName = "Name"                      ; name from who the email was sent
$FromAddress = "XXXXXXX@gmail.com"      ; address from where the mail should come
$ToAddress = "XXXXXXX@gmail.com"        ; destination address of the email - REQUIRED
$Subject = "Userinfo"                   ; subject from the email - can be anything you want it to be
$Body = "Hello"                         ; 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 = ""                        ; Send message priority: "High", "Normal", "Low"
$Username = "XXXXXXX@gmail.com"         ; username for the account used from where the mail gets sent - REQUIRED
$Password = "XXXXXXXX"                  ; password for the account used from where the mail gets sent - REQUIRED
$IPPort=465                             ; GMAIL port used for sending the mail
$ssl=1                                  ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS


$rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
MsgBox (0,"aaa",$rc)
Link to comment
Share on other sites

$objEmail.BodyPart.Charset = "utf-8"
    $objEmail.HTMLBodyPart.Charset = "utf-8"

 

In my projects where I use CDO.Message I use this (I don't use Jos's UDF just direct simplified code)

$objMessage.BodyPart.ContentTransferEncoding = "8bit"
    $objMessage.BodyPart.CharSet = "windows-1250"

1250 is ANSI Czech code page for Czech Windows.

Link to comment
Share on other sites

Sorry Jos,

Include file below:

#include<file.au3>
;##################################
; Variables
;##################################
$SmtpServer = "MailServer"              ; address for the smtp-server to use - REQUIRED
$FromName = "Name"                      ; name from who the email was sent
$FromAddress = "your@Email.Address.com" ; address from where the mail should come
$ToAddress = "your@Email.Address.com"   ; destination address of the email - REQUIRED
$Subject = "Userinfo"                   ; subject from the email - can be anything you want it to be
$Body = ""                              ; 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 = "CCadress1@test.com"       ; address for cc - leave blank if not needed
$BccAddress = "BCCadress1@test.com"     ; address for bcc - leave blank if not needed
$Importance = "Normal"                  ; Send message priority: "High", "Normal", "Low"
$Username = "******"                    ; 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 = 25                            ; port used for sending the mail
;$ssl = 0                                ; enables/disables secure socket layer sending - put to 1 if using httpS
$IPPort=465                             ; GMAIL port used for sending the mail
$ssl=0                                  ; 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 : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console
            If FileExists($S_Files2Attach[$x]) Then
                ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF)
                $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
Link to comment
Share on other sites

@kingsped,Jos

instead of

If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then
        $objEmail.HTMLBody = $as_Body
    Else
        $objEmail.Textbody = $as_Body & @CRLF
    EndIf
is better this

If StringInStr($as_Body, "</html>") Then
        $objEmail.HTMLBody = $as_Body
    Else
        $objEmail.Textbody = $as_Body
    EndIf
I do it this way in my projects. Edited by Zedna
Link to comment
Share on other sites

Zedna, Jos

Tried your mod, Zedna, but still get same results:  Same error msg from function but email sent promptly and correctly.

Should also mention that get same result with Win Firefall & Norton Antivirus OFF.

Edited by kingsped
Link to comment
Share on other sites

  • Developers

Zedna, Jos

Tried your mod, Zedna, but still get same results:  Same error msg from function but email sent promptly and correctly.

Should also mention that get same result with Win Firefall & Norton Antivirus OFF.

You need to remove at least this portion of the file, but really all lines between "#Include <File.au3>" and "; The UDF"

$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

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

  • Developers

@kingsped,Jos

instead of

If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then
        $objEmail.HTMLBody = $as_Body
    Else
        $objEmail.Textbody = $as_Body & @CRLF
    EndIf
is better this

If StringInStr($as_Body, "</html>") Then
        $objEmail.HTMLBody = $as_Body
    Else
        $objEmail.Textbody = $as_Body
    EndIf
I do it this way in my projects.

 

This is indeed a good option.

Thanks

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

  • 3 weeks later...

Hey coders...this is almost perfect for a thing my boss is having me do.  If anyone wants to make a couple of bucks and can do this quickly hit me up via jabber please.  I need something just like this but the only change is to add a way to put in up to 10 smtp server accounts and when it sends the mail it goes from 1 account to the next to the next.  So not 1 account is going crazy but it shares the load.  If you can do this hit me up and I will hire you for this.  Thanks for all the rockin code guys...for us non coders this stuff rocks.  Keep it up!  jabber is justanotherjoe at jabber.ru.  cheers

Link to comment
Share on other sites

This smells like someone trying to generate spam. 

I hate spam.

Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Link to comment
Share on other sites

  • 1 month later...

Jos i just want to thank you for this great script! I was looking for something like this for a long time. At fist i was using blat but your script looks so much easier. FYI i have run a few tests with excel files and sends them perfectly. I can't thank you enough!

Link to comment
Share on other sites

I really like this script and and I haven't had any problems until now.
After running I get this errors:

### COM Error !  Number: 80029C4A   ScriptLine: 65   Description:
### COM Error !  Number: 80029C4A   ScriptLine: 66   Description:
### COM Error !  Number: 80029C4A   ScriptLine: 68   Description:
### COM Error !  Number: 80029C4A   ScriptLine: 71   Description:
### COM Error !  Number: 80029C4A   ScriptLine: 72   Description:
### COM Error !  Number: 80029C4A   ScriptLine: 73   Description:
### COM Error !  Number: 80029C4A   ScriptLine: 76   Description:
### COM Error !  Number: 80029C4A   ScriptLine: 79   Description:
### COM Error !  Number: 80029C4A   ScriptLine: 85   Description:
### COM Error !  Number: 80029C4A   ScriptLine: 89   Description:
### COM Error !  Number: 80020009    ScriptLine: 91   Description:The "SendUsing" configuration value is invalid.

I double checked parameters, try to use different gmail address, turned off anti-virus&firewall (ESET SS) but still get this errors.

Using google I found that

80029C4A = Error loading type library/DLL

Any ideas how to fix this problem?

Code:

#include <File.au3>
#include <Inet.au3>

;##################################
; Variables
;##################################
$SmtpServer = "smtp.gmail.com"              ; address for the smtp-server to use - REQUIRED
$FromName = "USER:"&@UserName               ; name from who the email was sent
$FromAddress = "myemail@gmail.com"          ; address from where the mail should come
$ToAddress = "myemail@gmail.com"            ; destination address of the email - REQUIRED
$Subject = "Subject"                        ; subject from the email - can be anything you want it to be
$Body = "Body"                              ; 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 = "myemail@gmail.com"             ; username for the account used from where the mail gets sent - REQUIRED
$Password = "emailpassword"                 ; 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")
    If @error Then MsgBox(16,"COM","CDO.Message COM error") ; No Error here
    $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 : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console
            If FileExists($S_Files2Attach[$x]) Then
                ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF)
                $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 ;ERROR AT THIS LINE
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer ;ERROR AT THIS LINE
    If Number($IPPort) = 0 then $IPPort = 25
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort ;ERROR AT THIS LINE
    ;Authenticated SMTP
    If $s_Username <> "" Then
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 ;ERROR AT THIS LINE
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username ;ERROR AT THIS LINE
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password ;ERROR AT THIS LINE
    EndIf
    If $ssl Then
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True ;ERROR AT THIS LINE
    EndIf
    ;Update settings
    $objEmail.Configuration.Fields.Update ;ERROR AT THIS LINE
    ; 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" ;ERROR AT THIS LINE
        Case "Low"
            $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low"
    EndSwitch
    $objEmail.Fields.Update ;ERROR AT THIS LINE
    ; Sent the Message
    $objEmail.Send ;ERROR AT THIS LINE
    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

Link to comment
Share on other sites

Oh, I forgot to mention that. It's Windows XP SP3. AutoIt v3.3.8.1 Stable.

I think it is. cdosys.dll* is present in C:WindowsSystem32

I tried to download cdo.dll** to system32 folder (and register it via "regsrv32 cdo.dll" command in cmd) - No success, I still get errors.

After that I followed these instruction to (re)install:  http://j-integra.intrinsyc.com/support/kb/article.aspx?id=113792 - That didn't help either.

* version: 6.2.4.0

** version: 5.5.2182.0

Errors:

### COM Error !  Number: 80029C4A   ScriptLine: 66   Description:
### COM Error !  Number: 80029C4A   ScriptLine: 67   Description:
### COM Error !  Number: 80029C4A   ScriptLine: 69   Description:
### COM Error !  Number: 80029C4A   ScriptLine: 72   Description:
### COM Error !  Number: 80029C4A   ScriptLine: 73   Description:
### COM Error !  Number: 80029C4A   ScriptLine: 74   Description:
### COM Error !  Number: 80029C4A   ScriptLine: 77   Description:
### COM Error !  Number: 80029C4A   ScriptLine: 80   Description:
### COM Error !  Number: 80029C4A   ScriptLine: 86   Description:
### COM Error !  Number: 80029C4A   ScriptLine: 90   Description:

This time without:

### COM Error !  Number: 80020009    ScriptLine: 91   Description:The "SendUsing" configuration value is invalid.

Edited by Dacha204
Link to comment
Share on other sites

  • Developers

You could try reinstalling outlook as there seem to be an issue with the cdo installation on your machine.

http://support.microsoft.com/default.aspx?scid=kb;en-us;327219

(80029C4A) Error loading type library/DLL.

 

 

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

Link to comment
Share on other sites

:thumbsup: SOLVED :thumbsup:

You were right Jos, there was issue with CDO.

I followed instruction from http://support.microsoft.com/default.aspx?scid=kb;en-us;327219 >> Reinstall Outlook Express (and Internet Explorer).
Ok, I unistalled Internet Explorer and Outlook via Add/Remove Components in Control Panel - Add/Remove Programs  HUGE MISTAKE
I also deleted some other dlls (iertutil.dll I think) and corrupted Windows installation. Somehow I managed to download missing dll using Ubuntu LiveCD. After that I reinstalled IE8 and Outlook Express but that didn't help.

Anyway here is how I solved the problem:

I downgraded cdosys.dll from version 6.2.4.0 (14. april 2008, 13:00:00) to version 6.0.6015.0 (24. januar 2004, 1:29:04):

1. Go to C:WINDOWSsystem32dllcache

2. Find cdosys.dll and rename it to cdosys.dll_Backup

3. Go to C:WINDOWSsystem32

4. Find cdosys.dll and rename it to cdosys.dll_Backup

5. Download cdosys.dll version 6.0.6015.0 from attachment below

6. Copy it to C:WINDOWSsystem32 (replace current one) (maybe it's good idea to copy it also in dllcache folder)

Windows may detect that cdosys.dll was replaced and ask you to revert, but ignore that. Step 1 and 2 are also for preventing Windows to revert changes to cdosys.dll

Thank you Jos for your support. I also included cdosys.dll v6.2.4.0 if someone wants to inspect why didn't work.

 

cdosys.dll_6.0.6015.0.rar

Extra:

cdosys.dll_v6.2.4.0.rar

Link to comment
Share on other sites

Hello Jos, Thanks for the great UDF. It's working great for me but with one minor problem.  The $rc always returns 0 even though it's successful and I do get the email promptly.  Shouldn't $rc return 1 when successful?  When I purposely put in a bad email server ip or port just to test the program so that it fails, I would like the @error code to function like the native _INetSmtpMail  function in such a way that it has some intelligence when it fails.  For example, the native _INetSmtpMail has the following @error codes.  I would then use these to write to a log with a more descriptive error message.  I would use _INetSmtpMail but it doesn't support smtp authentication.  Please help.  Thank you.

@error: 1 - Invalid Parameters   2 - Unable to start TCP   3 - Unable to resolve IP   4 - Unable to create socket

 

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