Sending email throught command had multiple steps, now Exchagne 2007 SP2 which works on Powershell V2 has introduced a new cmdlet Send-Mailmessage. Sending email with Send-MailEssage is just single line command Below is the example of the same
Send-MailMessage –From Krishna.k@domain.com –To Rajesh@domain.com –Subject “Send-MailMessage Test” –Body “Send-MailMessage Test” -Attachments “c:\Attachment.txt” –SmtpServer Hubserver.domain
hi, if on Exchange 2010, param -SmtpServer is hub server or CAS server? thanks.
Hi,
STMP Server is hub 🙂
Regards,
Krishna
Hi Krishna:
Good command but I am having an error from powershell in exchange 2010. Send-MailMessage : Service not available, closing transmission channel. The server response was: 4.3.2 Service not available
Any ideas
lee
Hi,
Thanks, its a cool option i was looking for.
How can we add multiple lines to the body (i.e. one sentence in the first line and second sentence in second line)
Hi Chandran,
You shold be able to use multiple lines. Below is the example of how you can use html with multiline
$BodyMessage = @”
This is the test body of the message with multiline.. wanted to test on this This data will be printed on the next line “@
Send-MailMessage –From Krishna.k@domain.com –To Rajesh@domain.com –Subject “Send-MailMessage Test” –Body $BodyMessage -Attachments “c:\Attachment.txt” –SmtpServer Hubserver.domain
Below link has some details on html sytax
Please Let me know if you need any more information..
Regards,
Krishna