Wrox Programmer Forums
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 24th, 2005, 02:01 PM
Registered User
Join Date: Apr 2005
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rupen
Default Sending mails.

i use following vbscript function, but not working,
Pls let me know what is wrong?
Function SendMail(receiver,sender,subject,content)
    Dim ObjSendMail
    Dim iConf
    Dim Flds

    Set ObjSendMail = CreateObject("CDO.Message")
    Set iConf = CreateObject("CDO.Configuration")
    Set Flds = iConf.Fields

    Flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1

    '**** Path below may need to be changed if it is not correct
    Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup"

    Set ObjSendMail.Configuration = iConf
    ObjSendMail.To = receiver
    ObjSendMail.CC = sender
    'ObjSendMail.BCC = receiver & "," & sender
    ObjSendMail.Subject = subject
    ObjSendMail.From = sender

    ' we are sending a html email.. simply switch the comments around to send an text email instead
    ObjSendMail.HTMLBody = content
    'ObjSendMail.TextBody = content


    Set ObjSendMail = Nothing
End Function

Rupen Anjaria.:)
We CAN'T avoid problems, but can solve it.
Old October 25th, 2005, 07:22 AM
Friend of Wrox
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco

try this script,

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<title>Picco: Send Email</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

'Sending a text email using authentication against a remote SMTP server
' Sample code submitted by Clint Baldwin, +1 (918) 671 3429
Const cdoSendUsingPickup = 1 
Const cdoSendUsingPort = 2 
Const cdoAnonymous = 0
' Use basic (clear-text) authentication. 
Const cdoBasic = 1
' Use NTLM authentication 
Const cdoNTLM = 2 'NTLM

' Create the message object.
Set objMessage = Server.CreateObject("CDO.Message")
'Set the from address this would be your email address.
objMessage.From = """Picco""<[email protected]>" 
' Set the TO Address separate multiple address with a comma
objMessage.To = "[email protected]"
' Set the Subject.
objMessage.Subject = "An Email From Picco." 
' Now for the Message Options Part. 
' Use standared text for the body.
objMessage.TextBody = _
"This is some sample message text.." & _
vbCRLF & _
"It was sent using SMTP authentication."

' Or you could use HTML as:
' objMessage.HTMLBody = strHTML

' ATTACHMENT : Add an attachment Can be any valid url
'objMessage.AddAttachment("file://C:\Program Files\Active Call Center\Examples\Goodbye.wav")

' This section provides the configuration information for the SMTP server.
' Specifie the method used to send messages.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = _

' The name (DNS) or IP address of the machine 
' hosting the SMTP service through which 
' messages are to be sent.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _
"smtp.aol.com" ' Or "mail.server.com"

' Specify the authentication mechanism 
' to use. 
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = _

' The username for authenticating to an SMTP server using basic (clear-text) authentication
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = _
"[email protected]"

' The password used to authenticate 
' to an SMTP server using authentication
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = _

' The port on which the SMTP service 
' specified by the smtpserver field is 
' listening for connections (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = _

'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = _

' Set the number of seconds to wait for a valid socket to be established with the SMTP service before timing out.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = _

' Update configuration

' Use to show the message.
' MsgBox objMessage.GetStream.ReadText

' Send the message.



Similar Threads
Thread Thread Starter Forum Replies Last Post
sending e-mails How To?? saudyonline General .NET 13 November 17th, 2006 01:00 AM
sending mails arabuafef Classic ASP Basics 0 July 18th, 2006 06:29 AM
INFO on Sending e-mails Varg_88 Beginning PHP 6 November 10th, 2004 04:19 AM
Sending e-mails using C# lily611 General .NET 3 June 30th, 2004 05:46 AM
Sending mails rajeshnerenki Pro VB 6 4 September 25th, 2003 03:34 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.