Graeme

_Inetmail errors

8 posts in this topic

Hi,

I wrote a script just at the beginning of this year. I used _Inetmail to open an email in Thunderbird, my default email client. Suddenly it is broken. It produces the error 1 which doesn't tell me much. Can anyone help with this.

I added this in Chat as I appear to be barred from General Help forum.. If anyone can tell me why this is I'd love to know.

Blessings

Graeme

Share this post


Link to post
Share on other sites



34 minutes ago, Graeme said:

I added this in Chat as I appear to be barred from General Help forum.

I moved it to support and wouldn't know why you are not able to create a thread in it.

34 minutes ago, Graeme said:

I used _Inetmail to open an email in Thunderbird,

Thunderbird is a client and not the server. What server are you connecting to when trying to send the SMTP mail?

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

When I first wrote the code, _inetmail opened my Thunderbird account and created an email with the email address, subject and content that I sent to it....

I didn't want to connect to a server but merely create the email so that I could send it.

Just now it failed..

Graeme

Share this post


Link to post
Share on other sites

I am lost: As I stated  _inetmail() connects to a SMTP server, not a client. So what about you show the code you are using?

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

This is the entry from the AutoIT help file

Function Reference


_INetMail

Opens default user's mail client with given address, subject, and body

#include <Inet.au3>
_INetMail ( $sMailTo, $sMailSubject, $sMailBody )

Parameters

$sMailTo Address for the E-Mail
$sMailSubject Subject for the E-Mail
$sMailBody Body for the E-Mail

Return Value

Success: the process identifier for the E-Mail client.
Failure: 0 and sets the @error flag to non-zero.

 

When I ran the code it did indeed open the email client but failed to open an email as it used to do when I first wrote the code. I hunted through the change log to see anything that may be causing this but found  nothing... The error code was 1, non zero as per the help file but this gives no indication of the problem.:(

Blessings

Graeme

 

 

Share this post


Link to post
Share on other sites

@Graeme

Quick look in UDF :

Func _INetMail($sMailTo, $sMailSubject, $sMailBody)
    Local $iPrev = Opt("ExpandEnvStrings", 1)
    Local $sVar, $sDflt = RegRead('HKCU\Software\Clients\Mail', "")
    If $sDflt = "Windows Live Mail" Then
        $sVar = RegRead('HKCR\WLMail.Url.Mailto\Shell\open\command', "")
    Else
        $sVar = RegRead('HKCR\mailto\shell\open\command', "")
    EndIf
    Local $iRet = Run(StringReplace($sVar, '%1', _INetExplorerCapable('mailto:' & $sMailTo & '?subject=' & $sMailSubject & '&body=' & $sMailBody)))
    Local $iError = @error, $iExtended = @extended
    Opt("ExpandEnvStrings", $iPrev)
    Return SetError($iError, $iExtended, $iRet)
EndFunc   ;==>_INetMail

Just check this 3 REGISTRY keys.

_Example()
Func _Example()
    Local $sVar, $sDflt = RegRead('HKCU\Software\Clients\Mail', "")
    If $sDflt = "Windows Live Mail" Then
        $sVar = RegRead('HKCR\WLMail.Url.Mailto\Shell\open\command', "")
    Else
        $sVar = RegRead('HKCR\mailto\shell\open\command', "")
    EndIf

    ConsoleWrite("! " & $sDflt & @CRLF)
    ConsoleWrite("! " & $sVar & @CRLF)
EndFunc    ;==>_Example

and post console output here:


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

Thanks very much for this enlightening answer.

Console output was

--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
!
!
+>17:15:09 AutoIt3.exe ended.rc:0
+>17:15:09 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 9.076

As you can see the keys don't exist in my computer. It may be that I haven't set them yet as I have only just created this account. I wanted a local account, not linked to a Microsoft account and I wonder if that was the problem. In any case as I know the client I want to use I've found a better way to do it using the command line parameters of Thunderbird directly.

 

Thanks again.

Blessings

Graeme

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