Jump to content

Automate Windows Live Mail (Like you can do with outlook)


Recommended Posts

Hello everyone. I have been trying to create a script that will work with another one of my programs that when you click "email this person" in my program it will run a script that opens up Windows Live Mail and creates a new email and will populate the To, Subject, CC's, and add attachments. I know you can do this fairly easy with outlook but I cant seem to find a way to do this with Windows Live Mail. I would love if anyone could help.

Link to comment
Share on other sites

hello infaf711, welcome to AutoIt forum!

you picked the wrong tool for the job. Windows Live Mail has no automation interface, except only ASP.NET SDK which seems to require too much investment for too little result. your options are:

1) write ASP.NET app to do it

2) automate partly by command line switches (all except attachment and cc, me think). the rest is by ConstrolSend() & ControlClick()

3) use another mail client, or perhaps >this.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

Thanks!

But that stinks, I wanted to see if there was a way to give people that don't want to have to buy outlook another option through the Live Mail. But you're right on it being too much of an investment, but thank you anyway!

Link to comment
Share on other sites

infaf711,

If all you want to do is send mail to an email address with attachments you can do that without having to interact with any email client.

I am currently using Windows Live Mail and regularly send email using SMTP.  I am using an old/modified version of _INetSMTPMail.  I have not used the distributed version yet.  It may be all that you need.

kylomas

edit: corrected function name

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

@kylomas, care to share your "old/modified version of _INetSMTPMail" ? the current version does not seem to support attachments.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

Forgive me if i am wrong, but like kylo said, can you simply not use CDO?

I know that this script i use supports attachments just fine.. i use it every day..

#Include<file.au3>
#include<ie.au3>

Global $smtpserver = "" ;smtpserver address
Global $fromname = ""
Global $fromaddress = ""
Global $toaddress = ""
Global $subject = ""
Global $body = "Greetings," & @CRLF & @CRLF & "This is an automated email please do not reply"
Global $attachfiles = "" ;filepath to file you want to attach
Global $ccaddress = ""
Global $bccaddress = ""
Global $importance = "Normal"
Global $username = ""
Global $password = ""
Global $ipport = 25
Global $ssl = 0
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

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)
            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
    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
    $objemail.configuration.fields.update
    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
    $objemail.send
    If @error Then
        SetError(2)
        Return $omyret[1]
    EndIf
    $objemail = ""
EndFunc

Exit

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)
    Return
EndFunc
Edited by 13lack13lade
Link to comment
Share on other sites

@13lack13blade, that is what i referred to here:

... or perhaps >this.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

  • 3 years later...
  • Moderators

@Addyson please do not resurrect old threads, especially when posting links to payware sites, which we do not support.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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