<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to send an email using a Windows Powershell script</title>
	<atom:link href="http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php</link>
	<description>I search, I bookmark, I write, You learn.</description>
	<lastBuildDate>Mon, 08 Mar 2010 10:20:09 -0600</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: mihir</title>
		<link>http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php/comment-page-1#comment-1224</link>
		<dc:creator>mihir</dc:creator>
		<pubDate>Tue, 23 Feb 2010 14:57:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php#comment-1224</guid>
		<description>i am getting following email
exception calling &quot;send&quot; with &quot;4&quot; argument(s): &quot;Mailbox unavailable.The server response was:5.0.0 access denied&quot;.

This account is working fine in sql server but i am getting this error in powershell</description>
		<content:encoded><![CDATA[<p>i am getting following email<br />
exception calling &#8220;send&#8221; with &#8220;4&#8243; argument(s): &#8220;Mailbox unavailable.The server response was:5.0.0 access denied&#8221;.</p>
<p>This account is working fine in sql server but i am getting this error in powershell</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Igor</title>
		<link>http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php/comment-page-1#comment-1223</link>
		<dc:creator>Igor</dc:creator>
		<pubDate>Mon, 22 Feb 2010 19:09:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php#comment-1223</guid>
		<description>I am having some trouble. 
Here is my code. I have edited out the domains of course and I am usign 2 variables.

$args[0] = $site
$args[1] = $site2

$emailFrom = &quot;user@domain.com&quot;
$emailTo = &quot;user2@domain.com&quot;
$subject = &quot;The $site has been deployed&quot;
$body = &quot;The $site has been deployed &quot;
$smtpServer = &quot;smtp.domain.com&quot;
$smtp = new-object Net.Mail.SmtpClient($smtpServer)


I execute it with the following error:
PS O:\Test&gt; .\email.ps1 test test
Exception calling &quot;Send&quot; with &quot;4&quot; argument(s): &quot;The SMTP server requires a secure connection or the client was not auth
enticated. The server response was: 5.7.1 Client was not authenticated&quot;
At O:\Test\email.ps1:10 char:11
+ $smtp.Send( &lt;&lt;&lt;&lt; $emailFrom, $emailTo, $subject, $body)
$smtp.Send($emailFrom, $emailTo, $subject, $body)</description>
		<content:encoded><![CDATA[<p>I am having some trouble.<br />
Here is my code. I have edited out the domains of course and I am usign 2 variables.</p>
<p>$args[0] = $site<br />
$args[1] = $site2</p>
<p>$emailFrom = &#8220;user@domain.com&#8221;<br />
$emailTo = &#8220;user2@domain.com&#8221;<br />
$subject = &#8220;The $site has been deployed&#8221;<br />
$body = &#8220;The $site has been deployed &#8221;<br />
$smtpServer = &#8220;smtp.domain.com&#8221;<br />
$smtp = new-object Net.Mail.SmtpClient($smtpServer)</p>
<p>I execute it with the following error:<br />
PS O:\Test&gt; .\email.ps1 test test<br />
Exception calling &#8220;Send&#8221; with &#8220;4&#8243; argument(s): &#8220;The SMTP server requires a secure connection or the client was not auth<br />
enticated. The server response was: 5.7.1 Client was not authenticated&#8221;<br />
At O:\Test\email.ps1:10 char:11<br />
+ $smtp.Send( &lt;&lt;&lt;&lt; $emailFrom, $emailTo, $subject, $body)<br />
$smtp.Send($emailFrom, $emailTo, $subject, $body)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mi.Ke.</title>
		<link>http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php/comment-page-1#comment-1220</link>
		<dc:creator>Mi.Ke.</dc:creator>
		<pubDate>Tue, 09 Feb 2010 06:41:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php#comment-1220</guid>
		<description>Hi Harley,

I want to use this code to send a mail after a 
GET-USER -Filter .... &#124; MOVE-MAILBOX .....
Every User should receive a mail at to be informed that his mailbox has been transferred to the new server (f.i. from 2003 --&gt; 2007)

Any idea how to get this work ?

Thx - Regards Mi.Ke.</description>
		<content:encoded><![CDATA[<p>Hi Harley,</p>
<p>I want to use this code to send a mail after a<br />
GET-USER -Filter &#8230;. | MOVE-MAILBOX &#8230;..<br />
Every User should receive a mail at to be informed that his mailbox has been transferred to the new server (f.i. from 2003 &#8211;&gt; 2007)</p>
<p>Any idea how to get this work ?</p>
<p>Thx &#8211; Regards Mi.Ke.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: arenas</title>
		<link>http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php/comment-page-1#comment-1165</link>
		<dc:creator>arenas</dc:creator>
		<pubDate>Fri, 13 Nov 2009 17:52:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php#comment-1165</guid>
		<description>hello to all :)

your script is so helpful!

i gat this error:
Exception calling &quot;Send&quot; with &quot;1&quot; argument(s): &quot;Échec d&#039;envoi du courrier.&quot;
 à : ligne:1056 caractère:10
+ $smtp.Send &lt;&lt;&lt;&lt; ($msg)

ps
i have us &quot;live.fr&quot;. and for the smtp i use : $smtpServer = “smtp.live.com” 
also i need to handle the &quot;port 25&quot;!

how i have to do?
many thx for you help
arenas</description>
		<content:encoded><![CDATA[<p>hello to all <img src='http://www.searchmarked.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>your script is so helpful!</p>
<p>i gat this error:<br />
Exception calling &#8220;Send&#8221; with &#8220;1&#8243; argument(s): &#8220;Échec d&#8217;envoi du courrier.&#8221;<br />
 à : ligne:1056 caractère:10<br />
+ $smtp.Send &lt;&lt;&lt;&lt; ($msg)</p>
<p>ps<br />
i have us &quot;live.fr&quot;. and for the smtp i use : $smtpServer = “smtp.live.com”<br />
also i need to handle the &quot;port 25&quot;!</p>
<p>how i have to do?<br />
many thx for you help<br />
arenas</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Allen</title>
		<link>http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php/comment-page-1#comment-957</link>
		<dc:creator>Allen</dc:creator>
		<pubDate>Fri, 23 Oct 2009 17:36:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php#comment-957</guid>
		<description>I&#039;m thrilled to see some PowerShell book recommendations, but which book is &quot;Pro PowerShell&quot;? I found three with the &quot;Pro Windows PowerShell...&quot; title.
Pro Windows PowerShell (Paperback) by Hristo Deshev
Professional Windows PowerShell (Programmer to Programmer) by Andrew Watt
Professional Windows PowerShell for Exchange Server 2007 Service Pack 1 (Programmer to Programmer) by Joezer Cookey-Gam, Brendan Keane, Jeffrey Rosen, and Jonathan Runyon

Thanx!</description>
		<content:encoded><![CDATA[<p>I&#8217;m thrilled to see some PowerShell book recommendations, but which book is &#8220;Pro PowerShell&#8221;? I found three with the &#8220;Pro Windows PowerShell&#8230;&#8221; title.<br />
Pro Windows PowerShell (Paperback) by Hristo Deshev<br />
Professional Windows PowerShell (Programmer to Programmer) by Andrew Watt<br />
Professional Windows PowerShell for Exchange Server 2007 Service Pack 1 (Programmer to Programmer) by Joezer Cookey-Gam, Brendan Keane, Jeffrey Rosen, and Jonathan Runyon</p>
<p>Thanx!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TomasH</title>
		<link>http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php/comment-page-1#comment-905</link>
		<dc:creator>TomasH</dc:creator>
		<pubDate>Thu, 15 Oct 2009 05:59:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php#comment-905</guid>
		<description>You&#039;re right Harley.
Thx a lot for your help. 

Cheers
Thomas</description>
		<content:encoded><![CDATA[<p>You&#8217;re right Harley.<br />
Thx a lot for your help. </p>
<p>Cheers<br />
Thomas</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hstagner</title>
		<link>http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php/comment-page-1#comment-904</link>
		<dc:creator>hstagner</dc:creator>
		<pubDate>Wed, 14 Oct 2009 16:08:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php#comment-904</guid>
		<description>Hello TomasH,

I believe that the attachment is being held open. Try this to close the attachment after you send it:

$att.Dispose()

at the end of the script. 

I hope this helps. Thank you again for reading!</description>
		<content:encoded><![CDATA[<p>Hello TomasH,</p>
<p>I believe that the attachment is being held open. Try this to close the attachment after you send it:</p>
<p>$att.Dispose()</p>
<p>at the end of the script. </p>
<p>I hope this helps. Thank you again for reading!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TomasH</title>
		<link>http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php/comment-page-1#comment-903</link>
		<dc:creator>TomasH</dc:creator>
		<pubDate>Wed, 14 Oct 2009 13:14:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php#comment-903</guid>
		<description>Hi, wow you work since morning :-)))

here is the last part of the script. Before this, some FOR-cyclus write messages into the file message.txt
If I delete whole this mailing-part, the deleting by &quot;RM&quot; works fine.

~
$workpath = &quot;\\Server1\share$\servermonitor&quot;
$filename = “$workpath\temp\message.txt”
$smtpServer = “sv057089”

$msg = new-object Net.Mail.MailMessage
$att = new-object Net.Mail.Attachment($filename)
$smtp = new-object Net.Mail.SmtpClient($smtpServer)

$msg.From = &quot;servermonitor@mydomain.com&quot;
$msg.To.Add(&quot;tomas.hyps@mydomain.com&quot;)
$msg.Subject = &quot;SERVERS-UPTIME-Morning report&quot;
$msg.Body = “The nightly log file is attached”
$msg.Attachments.Add($att)

$smtp.Send($msg)

write.host &quot;Message has been sent.&quot; -fore green

rm $workpath\temp\message2.txt
} 
this is the real end of the file.

Thank you in advance for a help.</description>
		<content:encoded><![CDATA[<p>Hi, wow you work since morning <img src='http://www.searchmarked.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ))</p>
<p>here is the last part of the script. Before this, some FOR-cyclus write messages into the file message.txt<br />
If I delete whole this mailing-part, the deleting by &#8220;RM&#8221; works fine.</p>
<p>~<br />
$workpath = &#8220;\\Server1\share$\servermonitor&#8221;<br />
$filename = “$workpath\temp\message.txt”<br />
$smtpServer = “sv057089”</p>
<p>$msg = new-object Net.Mail.MailMessage<br />
$att = new-object Net.Mail.Attachment($filename)<br />
$smtp = new-object Net.Mail.SmtpClient($smtpServer)</p>
<p>$msg.From = &#8220;servermonitor@mydomain.com&#8221;<br />
$msg.To.Add(&#8221;tomas.hyps@mydomain.com&#8221;)<br />
$msg.Subject = &#8220;SERVERS-UPTIME-Morning report&#8221;<br />
$msg.Body = “The nightly log file is attached”<br />
$msg.Attachments.Add($att)</p>
<p>$smtp.Send($msg)</p>
<p>write.host &#8220;Message has been sent.&#8221; -fore green</p>
<p>rm $workpath\temp\message2.txt<br />
}<br />
this is the real end of the file.</p>
<p>Thank you in advance for a help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hstagner</title>
		<link>http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php/comment-page-1#comment-902</link>
		<dc:creator>hstagner</dc:creator>
		<pubDate>Wed, 14 Oct 2009 12:53:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php#comment-902</guid>
		<description>Hello TomasH,

Can you send me the code that you have written? Thank you for reading!</description>
		<content:encoded><![CDATA[<p>Hello TomasH,</p>
<p>Can you send me the code that you have written? Thank you for reading!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TomasH</title>
		<link>http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php/comment-page-1#comment-901</link>
		<dc:creator>TomasH</dc:creator>
		<pubDate>Wed, 14 Oct 2009 09:46:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.searchmarked.com/windows/how-to-send-an-email-using-a-windows-powershell-script.php#comment-901</guid>
		<description>Small update:
1) this file is on network drive f.ex. \\server1\share$
2) i checked it by process explorer, and there is information who keeps this file.
powershell.exe    2448(PID)  Handle  \device\LanmanRedirector\server1\share$\servermonitor\temp\message.txt

I can kill this handle, then I can delete the file and powershell is still usable. But it is not the best way.</description>
		<content:encoded><![CDATA[<p>Small update:<br />
1) this file is on network drive f.ex. \\server1\share$<br />
2) i checked it by process explorer, and there is information who keeps this file.<br />
powershell.exe    2448(PID)  Handle  \device\LanmanRedirector\server1\share$\servermonitor\temp\message.txt</p>
<p>I can kill this handle, then I can delete the file and powershell is still usable. But it is not the best way.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
