views:

297

answers:

7

I'm hunting for a mail sending program which can be used with command line arguments.

Ive tried jaber's sendmail . Its really neat, but its unfortunately broken for SSL auth.

Any alternatives ?

(Oh yeah, I dont want to use perl :P)

A: 

Googling your question's title gives plenty of results...

Assaf Lavie
trust me , ive tried all of them , most of them are paid tho
Reno
+1  A: 

You could use exim under windows by installing cygwin. I've used it as an outgoing MTA on windows before. Pretty sure it has a sendmail facade as well.

Evan
+1  A: 

Blat

Reno
A: 

A werid option : You can get the sendmail.cpp and .h and include in your project. It uses blat internally in a very exotic way.

I was thinking of launching the cmd prompt earlier using ShellExecute(..) to send mails but this is a much more mysterious way of sending mails. Har Har!

Geez I always end up answering my own question.

Reno
+2  A: 

You can use a small PowerShell script:

$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($emailFrom, $emailTo, $subject, $body)

Values to the function calls must be retrieved from the command line parameters using the $args array.

devio
A: 

> Googling your question's title gives plenty of results...

Totally Right. Incredible to see again such questions answered 250 000 times for 20 years !

*sigh* if you cannot contribute, don't be a troll
Reno
+1  A: 

As Reno mentions SSL in his question I suggest to keep in mind that Net.Mail.SmtpClient only supports Explicit SSL. In practice you usually will be ok if you use port 587 instead of 465 like your mail client application does. See more details here

System.Net.Mail with SSL to authenticate against port 465

Oleg Zhylin