new line in textbody of email.

Posted on 2008-02-08
Medium Priority
Last Modified: 2012-05-05
I have the following code and its not putting a newline where I want it.  Any ideas?
strcounter = Wscript.Arguments(0)
' Define who the email is sent from, must be in valid format (can be bogus address)
emailFrom = ""
' Define who the email is sent To
email_arr = array("cmuench@casit.net","cmuench@gmail.com")
' Define the SMTP server to handle the email
SMTPserver = ""
' Define the SMTP server port to used
'*** Line 40
SMTPport = "27"
'Define the SMTP username to send
SMTPuser = ""
'Define the SMTP password for the above user
SMTPpasswd = ""
' Send the email out
' split string into array
' loop through array and call SendEmail sub
for Each email in email_arr
sub SendEmail(emailTo)
' Define the action
Set objEmail = CreateObject("CDO.Message")
' Who, What, Where, When, Why, How
objEmail.From = emailFrom
objEmail.To = emailTo
' Edit the subject and body as required...
objEmail.Subject = "Low Disk Space!!! on agrove."
objEmail.Textbody = "A low disk space error has occurred from the following counter. "&strcounter &"\r\nAt this time" & Now()
' Define email server settings
objEmail.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPserver 
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = SMTPuser
'Your password on the SMTP server
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = SMTPpasswd
'Server port (typically 25)
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPport
'Use SSL for the connection (False or True)
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
' Send the EMAIL
End Sub
' Stop the script in case it doesn't automatically

Open in new window

Question by:casit
  • 2
LVL 25

Accepted Solution

Lee Savidge earned 2000 total points
ID: 20852044

Change the line to:

objEmail.Textbody = "A low disk space error has occurred from the following counter. "&strcounter & vbCrLf & "At this time" & Now()



Author Comment

ID: 20852096
Thanks.  Guess I need some coffee
LVL 25

Expert Comment

by:Lee Savidge
ID: 20852128
It's Friday. Beer time :)



Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Script to copy or move mouse-selected collection of files plus targets referenced by shortcuts (.lnk) The purpose of this article is to help illuminate the real challenges and options available (where they may exist) for utilizing simple scriptin…
In this article we want to have a look at the directory attributes which are used by Microsoft to store the so called Security Identifiers (SID). These SIDs plays an important role in delegating and granting permissions and in authentication of trus…
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…
Did you know PowerShell can save you time with SaaS platforms? Simply leverage RESTfulAPIs to build your own PowerShell modules. These will kill repetitive tickets and tabs, using the command Invoke-RestMethod. Tune into this webinar to learn how…

588 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question