views:

3465

answers:

5

What is the best way to send e-mail using outlook express from the command line? It has to be an automated operation with no user interaction. There will be some .jpg files in attachment. Thanks.

+1  A: 

Perhaps this post is helpful. It speaks pre-populating a new e-mail message and including a file.

Aron Rotteveel
A: 

Outlook Express and not Microsoft Outlook

bosnic
have you tried the above with Outlook Express?
Aron Rotteveel
+1  A: 

Does it really need to use Outlook Express to send the email?

Can't you use a third-party command line email tool or do you need it to use Outlook Express' settings and for the mails to end up in the Sent folder?

If you can use a third-party tool, something like absoluteTools SendMail CMD might do the job.

Steve Morgan
A: 

This thread: Send mail from a Windows script might help you, I think.

PhiLho
A: 

Quick'n dirty AutoIt script, you can modify it to accept parameters from the command line:

; Send a mail vía outlook "automation"

$sRcpt = "[email protected]"
$sSubj = "Test subject"
$sBody = "This is a test"
$sAttach = "g:\AutoIt\AnHoras.PRG"

If Not WinActivate ("[REGEXPTITLE:.*\- Outlook Express]") Then
    RunWait ("d:\Archivos de programa\Outlook Express\msimn.exe")   ; Set your path to the Outlook .exe
Endif

Send ("!anm")   ; Archivo->Nuevo->Mensaje (in spanish, sorry, I suppose that in english it will be File->New->Message)
Send ($sRcpt & "{Tab 3}")
Send ($sSubj & "{Tab}")
Send ($sBody)

If $sAttach <> "" Then
    Send ("!i{Enter}" & $sAttach & "{Enter}")      ; Insertar adjunto (Insert->Attachment)
EndIf

Send ("!a{Down}{Enter}")        ; Archivo->Enviar mensaje (File->Send message)
PabloG