<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>vbscriptblog.com &#187; cdo</title>
	<atom:link href="http://vbscriptblog.com/category/vbscript/cdo/feed/" rel="self" type="application/rss+xml" />
	<link>http://vbscriptblog.com</link>
	<description>Scripting for Windows Sysadmins</description>
	<lastBuildDate>Mon, 16 Jan 2012 09:41:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>CDO: VBscript to send an email (needs an smtp server)</title>
		<link>http://vbscriptblog.com/vbscript/cdo-vbscript-to-send-an-email-needs-an-smtp-server/</link>
		<comments>http://vbscriptblog.com/vbscript/cdo-vbscript-to-send-an-email-needs-an-smtp-server/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 11:49:39 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[cdo]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://deludi.nl/blog/?p=286</guid>
		<description><![CDATA[For many years it is possible to send emails from scripts/command line. One of the best known programs is blat (blat.exe). When you are scripting in VBscript it is more convenient to send an email with vbs instead of calling other executables. This script contains a function which takes two variables, the recipient and the [...]]]></description>
			<content:encoded><![CDATA[<p>For many years it is possible to send emails from scripts/command line.<br />
One of the best known programs is blat (blat.exe).<br />
When you are scripting in VBscript it is more convenient to send an email with vbs instead of calling other executables.<br />
This script contains a function which takes two variables, the recipient and the header.<br />
With a little modification the function can handle more variables.</p>
<p>Follow the next steps to make and run the script (no admin rights  needed):</p>
<ul>
<li>open your favorite text editor (mine is notepad++)</li>
<li>copy and paste the script into the editor (delete the line numbers)</li>
<li>save the script (for example c:tempsendmail.vbs)</li>
<li>open a command prompt</li>
<li>go to &#8220;c:temp&#8221;</li>
<li>give &#8220;cscript sendmail.vbs&#8221; (without quotes) and enter</li>
</ul>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : sendmail.vbs
' Description : script to send an email (needs an smtp server)
' Author : dirk adamsky - deludi bv
' Version : 1.00
' Date : 10-02-2010
' Level : beginner

Sendmail &quot;test@recipient.org&quot;,&quot;this is a testmessage&quot;

Function SendMail(strRecipient, strHeader)
		Set objMessage = CreateObject(&quot;CDO.Message&quot;)
		objMessage.Subject = strHeader
		objMessage.From = &quot;testuser@test.org&quot;
		objMessage.To = strRecipient
		objMessage.TextBody = &quot;This is an automated message&quot;
		objMessage.Configuration.Fields.Item (&quot;http://schemas.microsoft.com/cdo/configuration/sendusing&quot;) = 2
		objMessage.Configuration.Fields.Item (&quot;http://schemas.microsoft.com/cdo/configuration/smtpserver&quot;) = &quot;your.smtp.server.here&quot;
		objMessage.Configuration.Fields.Item (&quot;http://schemas.microsoft.com/cdo/configuration/smtpserverport&quot;) = 25
		objMessage.Configuration.Fields.Item (&quot;http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout&quot;) = 60
		objMessage.Configuration.Fields.Update
		objMessage.Send
		Set objMessage = Nothing
End Function
</pre>
<p>When you have problems/questions please post a reply.</p>
<p>Happy scripting.</p>
<p>Dirk Adamsky &#8211; Deludi BV</p>
<div class="bottomcontainerBox" style="background-color:#F0F4F9;">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fvbscriptblog.com%2Fvbscript%2Fcdo-vbscript-to-send-an-email-needs-an-smtp-server%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://vbscriptblog.com/vbscript/cdo-vbscript-to-send-an-email-needs-an-smtp-server/"></g:plusone>
			</div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://vbscriptblog.com/vbscript/cdo-vbscript-to-send-an-email-needs-an-smtp-server/"  data-text="CDO: VBscript to send an email (needs an smtp server)" data-count="horizontal" data-via="dirkadamsky">Tweet</a>
			</div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://vbscriptblog.com/vbscript/cdo-vbscript-to-send-an-email-needs-an-smtp-server/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/cdo-vbscript-to-send-an-email-needs-an-smtp-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

