casit
asked on
new line in textbody of email.
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
SendEmail(email)
next
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
objEmail.Configuration.Fields.Update
' Send the EMAIL
objEmail.Send
End Sub
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' Stop the script in case it doesn't automatically
WScript.Quit
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It's Friday. Beer time :)
Regards,
Lee
Regards,
Lee
ASKER