Search notes:

PowerShell cmdLet Send-MailMessage

$username = 'peterTheWolf'
$password = 'littleRedCap'

$secStr   = convertTo-secureString -string $password -asPlainText -force
$cred     = new-object System.Management.Automation.PSCredential $username, $secStr

send-mailMessage                                `
  -from          'me@here.xyz'                  `
  -to            'you@there.abc'                `
  -subject       'The zip'                      `
  -smtpServer    'smtp.some.where'              `
  -useSSL                                       `
  -port           587                           `
  -credential    $cred                          `
  -attachments    foo-bar-baz.zip               `
  -body         @'
Hello

here's the zip file
'@

Warning

Note, Microsoft's documentation has the following warning:
The Send-MailMessage cmdlet is obsolete. This cmdlet does not guarantee secure connections to Perl module Net::SMTP servers. While there is no immediate replacement available in PowerShell, we recommend you do not use Send-MailMessage. For more information, see Platform Compatibility note DE0005.

Timing out

If send-mailMessage cannot connect to the given SMTP server or indicated port, the cmdLet does not give a meaningful error message. It just says the operation has timed out.

See also

The value of the preference variable $psEmailServer can be set to the SMTP server. This value is used if the parameter -smtpServer is not specified.
send-mailMessage belongs to the cmdlets with the -encoding parameter.
Powershell command noun: mailMessage

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Windows/...', 1759382929, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Windows/PowerShell/command-inventory/noun/mailMessage/send(70): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78