|
-
Aug 7th, 2000, 02:44 AM
#1
Thread Starter
Addicted Member
Can anyone show me some code on how to email using vbscirpt?
Thank you.
-
Aug 7th, 2000, 03:52 AM
#2
Code:
Set objMailer = Server.CreateObject("CDONTS.Newmail") ' Reference the Mailer object variable to an instance of "CDONTS.Newmail"
objMailer.To = "[email protected]" 'Fillin the to email address...
objMailer.From = "[email protected]" ' ...the from email address...
objMailer.Subject = "Email Subject" ' ...the subject...
objMailer.BodyFormat = 0 '... and prepair to send it as
objMailer.MailFormat = 0 ' HTML formatted email
objMailer.Body = "Sample email message." 'The message to send
'Send the email and dismiss the mailer object
objMailer.Send
Set objMailer = Nothing
This works on IIS 4/5 so long as you have the CDONTS.NewMail object working.
If you want to send HTML mail, set the BodyFormat and MailFormat to 0. Otherwise I think you set them to 1...not quite sure as I never send plain text emails. 
[Edited by matthewralston on 08-07-2000 at 04:54 AM]
-
Aug 7th, 2000, 02:44 PM
#3
Thread Starter
Addicted Member
Thanks alot
I understand the code but the only question i have is reference the mailer object variable to a instance of ("CDONTS.newmail") <----------- what is "CDONTS.newmail"
haha Now i dont me too sound retarded or anything but i dont remember seening that refernce in visual basic.
Thanks MatthewR.
-
Aug 9th, 2000, 05:25 PM
#4
You won't see it in straight VB. It's an ActiveX control that comes with IIS for NT. It's basically a mini program that actually sends the email for you.
CDONTS actually stands for Collaboration Data Objects for NT Server, and has the following sub components:
Code:
Session
Folder (Inbox or Outbox)
Messages collection
Message
AddressEntry
Attachments collection
Attachment
Recipients collection
Recipient
NewMail
I canne explain that object model...just copied it outta MSDN. 
-
Aug 9th, 2000, 07:15 PM
#5
Addicted Member
Heh
Another way of doing it is something like this:
(This will allow you to CC as well as a few other things)
(Make a function named MailThis)
Function MailThis(strSubject, strBody)
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = Session("Who sends it's Name")
Mailer.FromAddress= Session("Who sends it's Addy")
Mailer.RemoteHost = "The Mail server"
Mailer.AddRecipient "Recipient's Name","Recipient's E-Mail"
(Take this next line out if unneeded)
Mailer.AddCC "CC's Name","CC's E-Mail"
Mailer.Subject = strSubject
Mailer.BodyText = strBody
End Function
Stephen Haney- 115 116 101 118 101 31 72 65 78 69 89
-ShardsOfSilence.net- ^ My name in ASCII ^
You forget something new every day
| WinME | VB6 Pro | MSC++ | Lambda MOO |
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|