Send Email

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 14 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
spectre87
Posts: 103
Last visit: Thu Jul 18, 2013 9:53 am

Send Email

Post by spectre87 »

I want to send an email, like I have below. The thing I can't figure out is how to put a hyperlink that points to the files folder. The way it is now tries to make it a hyperlink, but there are spaces in the location so it only creates the hyperlink with text from the begining until the first space.

Code: Select all

'Send Email
Set objEmail = CreateObject("CDO.Message")
Set objMessage = CreateObject("CDO.Message") 
objEmail.From = "rsherer@ricetec.com"
objEmail.To = "rsherer@ricetec.com"
objEmail.Subject = "Planned Remote Script - Shutdown"
objMessage.CreateMHTMLBody "srv1groupsit group datahqdrlogs"
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "rtexch01"
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")  = 2
objEmail.Configuration.Fields.Update
objEmail.Send
User avatar
spectre87
Posts: 103
Last visit: Thu Jul 18, 2013 9:53 am

Send Email

Post by spectre87 »

I tried this same thing on Monday, I just forgot the file:/// part
User avatar
spectre87
Posts: 103
Last visit: Thu Jul 18, 2013 9:53 am

Send Email

Post by spectre87 »

objMessage.TextBody = got it
User avatar
spectre87
Posts: 103
Last visit: Thu Jul 18, 2013 9:53 am

Send Email

Post by spectre87 »

Now it kicks back saying there is an error but the details states: Unknown
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Send Email

Post by jvierra »

File must exist and be readable. It is not a link to put in teh body but a link to a file touse for the body.

See documentation.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Send Email

Post by jvierra »

Is this what you are trying to do?

objEmail.Subject = "Planned Remote Script"objEmail.HTMLBody = "file:///e:testtest99.htm"
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Send Email

Post by jvierra »

Again - do ot like this:

objEmail.HTMLBody = "<a href='file:///e:test filestest99.htm'>e:test filestest99.htm</a>"
User avatar
rasimmer
Posts: 182
Last visit: Fri Apr 25, 2014 7:00 am

Send Email

Post by rasimmer »

@jvierra
Don't you have to create the typical HTML tags around the <A> or does HTMLBody indicate the html document is there and you are writing inside the <body> tags?
User avatar
spectre87
Posts: 103
Last visit: Thu Jul 18, 2013 9:53 am

Send Email

Post by spectre87 »

No, it works the way he described works.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Send Email

Post by jvierra »

Shouldn't matter. HTML is mergable. Two sets of body tags should always be merged. I suspect CDO does this too as it uses the MSHTML object same as everyone else.
This topic is 14 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked