Jump to content

INetMail


Recommended Posts

$Address = "xyz@anywhere.com"

$Subject = "Hello"

$Body = "Error handling made easy?"

_INetMail($Address, $Subject, $Body)

This routine on my Vista system launches Outlook and fills out the address and subject lines together with text in the body of the message it works perfectly.

However if I was running the script on a system which did not have an Email Client how would you trap the error caused if _INetMail ddid not launch the Email Client [for what ever reason]

Help is always appreciated. Ant..

Link to comment
Share on other sites

Are you looking for something like this?

$mail = _INetMail($Address, $Subject, $Body)
If $mail = 0 Then
   MsgBox(0,"","The value of @error is: " & @error)
EndIf
Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt
Link to comment
Share on other sites

Are you looking for something like this?

$mail = _INetMail($Address, $Subject, $Body)
If $mail = 0 Then
   MsgBox(0,"","The value of @error is: " & @error)
EndIf
Bother why could'nt I think of that [todays lesson - thanks Airwolf] looks to easy...... does it return zero because there are no values in $address,$subject,$body or because a mail client is not installed on the desktop or both? What mail clients will it launch or is it specific to Windows mail clients?

Ant..

Link to comment
Share on other sites

Bother why could'nt I think of that [todays lesson - thanks Airwolf] looks to easy...... does it return zero because there are no values in $address,$subject,$body or because a mail client is not installed on the desktop or both? What mail clients will it launch or is it specific to Windows mail clients?

Ant..

If the client successfully launches, it will return the process id. Otherwise, it returns 0 and sets @error to non-zero. It should work with any mail client, so long as it is set as your default mail client in Windows. Even if you've got a fresh install of XP or Vista and you haven't installed anything else, you'll already have a default mail client built-in to the OS (Outlook Express or Windows Mail).
Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt
Link to comment
Share on other sites

If the client successfully launches, it will return the process id. Otherwise, it returns 0 and sets @error to non-zero. It should work with any mail client, so long as it is set as your default mail client in Windows. Even if you've got a fresh install of XP or Vista and you haven't installed anything else, you'll already have a default mail client built-in to the OS (Outlook Express or Windows Mail).

I guess that this is probably how it should look

CODE

$Address = "anyone@anywhere.net"

$Subject = "This and that"

$Body = "Trap the error "

_INetMail($Address, $Subject, $Body)

If @error = 1 Then

MessageAndLog("Email Client NOT FOUND",200)

EndIf

The 200 in MessageAndLog = the value to set the width in a Splash window. Do you know the formula that automatically sets the Msgbox width?

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