Microsoft – PowerShell – Net.Mail.SmtpClient – Send – Error Message – Exception Calling Send

Microsoft – PowerShell – Net.Mail.SmtpClient – Send – Error Message – Exception Calling Send

Who needs therapy when you one can just talk to oneself and call it a Blog.

I guess that is what programmer’s call Introspection…..

Need a quick email notification and so googled for one and downloaded it over the .Net

It is actually nice and clean.

But, as I used it kept getting this error message:

Exception calling "Send" with "1" argument(s): "failure sending mail."

At ......ps1:#### char:##

+  $smtp: send <<<< ($mailMessage)

    +   CategoryInfo           : NotSpecified: (:) [], MethodInvocationException
    +   FullyQualifiedErrorId  : DotNetMethodException

The more I looked a the line of code, it looked OK. But, the error message seemed a big big.

And, so I printed out my data.

The problem ended up being that rather than having the actual smtp server, I had the old

place holder.

Nice one MS. But, it will really be nice to have a little “sanitary code” at the top of

each method. Just a little “assert” code will be nice.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s