locked
How to write batch script to send email without installing any email program(like outlook)? RRS feed

  • Question

  • Hi,

    we are able to send email using mapisend in batch script. mapisend command works fine as we have outlook installed in our machine.But we have need sending email from batch script without having any email program like outlook installed.

    When i tried the blat ,i got the below error.

    Error: Mail server refused connection.Error: Not a socket.

    Please help us out on this.

    Thanks,

    Mathiyarasu B

    Mob no +91 9095286870

    Wednesday, August 28, 2013 9:28 AM

Answers

  • The error message seems to indicate that your domain blocks mail on port 25.  This is common so check with admins to find out if mail is allowed.

    Outlook uses MAPI and the profile so it knows how to use the Exchange or IMAP APIs directly.  BLAT and Send-MailMessage use SMTP which is very often blocked in an enterprise.


    ¯\_(ツ)_/¯

    • Marked as answer by Bill_Stewart Sunday, December 29, 2013 7:25 PM
    Wednesday, August 28, 2013 3:20 PM

All replies

  • I am not sure about your needs but you can achieve this using PowerShell.

    $From = "YourmailID@domain.com"
    $to = "YourmailID@domain.com"
    $Subject = "Some Text"
    $Body = "Some Text"
    $SMTP = "Your SMTP Name"
    Send-MailMessage -From $from -To $to -Body $body -SMTPServer $SMTP

    Please check and revert.

    Wednesday, August 28, 2013 9:50 AM
  • The error message seems to indicate that your domain blocks mail on port 25.  This is common so check with admins to find out if mail is allowed.

    Outlook uses MAPI and the profile so it knows how to use the Exchange or IMAP APIs directly.  BLAT and Send-MailMessage use SMTP which is very often blocked in an enterprise.


    ¯\_(ツ)_/¯

    • Marked as answer by Bill_Stewart Sunday, December 29, 2013 7:25 PM
    Wednesday, August 28, 2013 3:20 PM