Skip to main content
Revised the wording for clarity
Source Link
Dscoduc
  • 7.8k
  • 11
  • 44
  • 49

Why does sending an email message from PowerShell with the Send-MailMessage command using the flag -Port 587 produce an error.

Command:

Send-Mailmessage -smtpServer mail.server.com -Port 587 -from "[email protected]" -to "[email protected]" -subject "Test" -body "Test" 

Error Message:

Send-Mailmessage : The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first

The PowerShell documentation says adding -UseSSL should specify that a STARTTLS command be sent -, but even adding this flag may not resolve your issues.

Command:

Send-Mailmessage -smtpServer mail.server.com -Port 587 -UseSsl -from "[email protected]" -to "[email protected]" -subject "Test" -body "Test" 

Eror message:

Send-Mailmessage : Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

Why does sending an email message from PowerShell with the Send-MailMessage command using the flag -Port 587 produce an error.

Command:

Send-Mailmessage -smtpServer mail.server.com -Port 587 -from "[email protected]" -to "[email protected]" -subject "Test" -body "Test" 

Error Message:

Send-Mailmessage : The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first

The PowerShell documentation says adding -UseSSL should specify that a STARTTLS command be sent - but even adding this flag may not resolve your issues.

Command:

Send-Mailmessage -smtpServer mail.server.com -Port 587 -UseSsl -from "[email protected]" -to "[email protected]" -subject "Test" -body "Test" 

Eror message:

Send-Mailmessage : Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

Why does sending an email message from PowerShell with the Send-MailMessage command using the flag -Port 587 produce an error.

Command:

Send-Mailmessage -smtpServer mail.server.com -Port 587 -from "[email protected]" -to "[email protected]" -subject "Test" -body "Test" 

Error Message:

Send-Mailmessage : The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first

The PowerShell documentation says adding -UseSSL should specify that a STARTTLS command be sent, but even adding this flag may not resolve your issues.

Command:

Send-Mailmessage -smtpServer mail.server.com -Port 587 -UseSsl -from "[email protected]" -to "[email protected]" -subject "Test" -body "Test" 

Eror message:

Send-Mailmessage : Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

Source Link
Dscoduc
  • 7.8k
  • 11
  • 44
  • 49

Why does Send-MailMessage fail to send using STARTTLS over Port 587

Why does sending an email message from PowerShell with the Send-MailMessage command using the flag -Port 587 produce an error.

Command:

Send-Mailmessage -smtpServer mail.server.com -Port 587 -from "[email protected]" -to "[email protected]" -subject "Test" -body "Test" 

Error Message:

Send-Mailmessage : The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first

The PowerShell documentation says adding -UseSSL should specify that a STARTTLS command be sent - but even adding this flag may not resolve your issues.

Command:

Send-Mailmessage -smtpServer mail.server.com -Port 587 -UseSsl -from "[email protected]" -to "[email protected]" -subject "Test" -body "Test" 

Eror message:

Send-Mailmessage : Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.