question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Send-MailMessage throw error and send the email

See original GitHub issue

Steps to reproduce

Run Send-MailMessage with CC or BCC, but without TO, and with BodyAsHTML.

Expected behavior

Either throw error and break (because TO is empty) or send the email (to CC or BCC) without an error.

Actual behavior

You get an error that the email address is invalid and the email is sent but empty.

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.0.9740.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.34014
BuildVersion                   6.3.9740.0
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.2

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ThreeFive-Ocommented, Sep 17, 2018

@adityapatwardhan In my opinion this issue can be closed. But another issue or PR should be made to improve the user experience when using non-valid email addresses in -To, -Cc and -Bcc. It’s on my To-Do, but other PRs for this cmdlet are more important, which I want to fix first.

0reactions
adityapatwardhancommented, Sep 17, 2018

@ThreeFive-O Thanks for the detailed analysis. Can this issue be closed since, the cmdlet is behaving as expected?

Read more comments on GitHub >

github_iconTop Results From Across the Web

[SOLVED] Error from Powershell When Sending Email
Solution: The error is suggesting the email from value is empty.... If this is going to be in powershell dump the .net and...
Read more >
Catch error from Send-MailMessage cmdlet when called ...
1 Answer. Wrap the whole command in a try catch block and throw an explicit error. This will return a non-zero exit code....
Read more >
Powershell send-MailMessage Exception
Found the solution. The credential used does not have permissions to send email as support@domain.com in -From "support@domain.com".
Read more >
Powershell Send-MailMessage Error
Brings up error:Send-MailMessage : The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5 ...
Read more >
How to throw an exception and send email as alert - Help
Hello I want to know how to send an email as notification/alerts in UiPath after successful Job or Exceptions? thanks in advance Ayyoub....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found