none
Trigger email from command line RRS feed

  • Question

  • Hi experts

    One of my application is triggering an email from windows server. The application is unable to trigger an email. 
    i have my smtp server settings as mail.contoso.com on port 29080, i want to trigger an email from command prompt to check its an application issue or relay issue. How can i trigger email from command prompt
    with the below settings

    SMTP settings: mail.contoso.com on port 29080
    my email: roger@contoso.com



    • Edited by Risingflight Tuesday, January 28, 2020 11:57 PM s
    Tuesday, January 28, 2020 11:57 PM

Answers

  • Hi,

    We can use the Send-MailMessage command to help us send an email message from within PowerShell

    $msolcred = get-credential
    
    Send-MailMessage –From roger@contoso.com –To user@domain.com –Subject “Test Email” –Body “Test SMTP Relay Service” -SmtpServer mail.contoso.com  -Credential $msolcred -UseSsl -Port 29080

    Regards,

    Joyce Shen


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    • Marked as answer by Risingflight Thursday, January 30, 2020 3:52 PM
    Thursday, January 30, 2020 1:58 AM