Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

E-mail

Status
Not open for further replies.

Per9922

IS-IT--Management
Oct 1, 2004
74
SE
Hello,

I would like to sebd an e-mail with help on a VBS script. I tried this:

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Example CDO Message"
objMessage.From = "<my e-mail>"
objMessage.To = "<my email>"
objMessage.TextBody = "This is some sample message text."
objMessage.Send

Do I need to do something more ?


Thanks Olof
 
Have a look here:
thread705-1369407

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV.

I scan the thread and the links, but not easy to understand what I miss.
 
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "me@mycompany.com"
objEmail.To = "someone@somecompany.com"
objEmail.Subject = "Subject"
objEmail.Textbody = "body of message"
objEmail.Configuration.Fields.Item _
(" = 2
objEmail.Configuration.Fields.Item _
(" = _
"name of smtpserver"
objEmail.Configuration.Fields.Item _
(" = 25
objEmail.Configuration.Fields.Update
objEmail.Send
 
Thanks egodette, sorry but what should I fill in for the last three ? How do you check which smtpserver you are using ?

Thanks
 
How do you check which smtpserver you are using
You have to know the smtpserver !!!!
 
Hello again, no, I do not know how is the internetprovider, there are not way to find out ?
 
I will assume this is your workplace (because if it was your home, you would certainly know who your ISP is???), so ask your IT Department or System Administrator. Or, find the person who pays the bills!!!
 
Hello again,

so the code should look like ?

Set objEmail = CreateObject("CDO.Message")
objEmail.From = "<My E-mail adress>"
objEmail.To = "<My E-mail adress>"
objEmail.Subject = "Test"
objEmail.Textbody = "body of message"
objEmail.Configuration.Fields.Item = 2
objEmail.Configuration.Fields.Item "name of smtpserver"
objEmail.Configuration.Fields.Item = 25
objEmail.Configuration.Fields.Update
objEmail.Send

1) Is this correct: The filed Item what should it be ?
objEmail.Configuration.Fields.Item = 2

2) Is this correct: The filed Item what should it be ?
objEmail.Configuration.Fields.Item = 25


Thanks for the help Olof



 
Hello gain, I hope anybody could help me to get this working,

I have tried to login to the smtp server via telnet and send mail from there and it works fine, but when i try to send via a VBS script it does not work :( I have tried serverla different variants among the two belong. Does anybody se any errors ? Do I need to do something else ?

Please help Olof

telnet <smtp server> 25
MAIL FROM:<E-mail>
RCPT TO:<E-mail>
DATA
Test telnet
.

'Version 1
'=========
Dim objEmail
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "<E-mail>"
objEmail.To = "<E-mail>"
objEmail.Subject = "Test VBS"
objEmail.Textbody = "body of message"
objEmail.Configuration.Fields.Item(" = 2
objEmail.Configuration.Fields.Item(" = "<smtp server>"
objEmail.Configuration.Fields.Item(" = 25
objEmail.Configuration.Fields.update
objEmail.Send

'Version 2
'=========
Dim objEmail
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "<E-mail>"
objEmail.To = "<E-mail>"
objEmail.Subject = "Test VBS"
objEmail.Textbody = "body of message"
objEmail.Configuration.Fields.Item("sendusing") = 2
objEmail.Configuration.Fields.Item("smtpserver") = "<smtp server>"
objEmail.Configuration.Fields.Item("smtpserverport") = 25
objEmail.Configuration.Fields.update
objEmail.Send
 
You are asking something you can discover yourself. What hinder you from running it and discover the error message?
 
I do not get any error.

I can not understand what is wrong when it works to telnet to the server and send an e-mail from there but not with the VBS script ....

Do you se what is wrong with the code ?
 
I suppose you copy msdn stuff. Say, I run a quick test on version 1, it sends out something... if your <...>'s are replaced by the real, of course.
 
Sorry, what do I need to copy from msdn ?
 
I meant you don't invent the script yourself, do you? you copy somewhere all the same, don't you?
 
Yes, you look around if you do not know how it works. So you copy my version 1 to 1++%, put in your e-mail and your smtp server and after that is works ?
 
How does it work, should the links go to a page ? If I copy the link it does not go page for me ....
 
There is nothing specifically related to one's requirement in the script version 1 or whatever. It is just a general emailing skeleton, so I reckon you copy from the best source (msdn/technet...) rather than some nth hand immitators. There is nothing wrong doing that. If that's not from the best source, I won't even test it for you as you're asking.

Now I had told you the script should work under the very bare and plain environment... you keep asking I don't know what... Why don't you tell the forum how do you execute the script, what platform...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top