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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDO - email SEND not working. error: The "SendUsing" configuration va 1

Status
Not open for further replies.

wvdba

IS-IT--Management
Jun 3, 2008
465
US
hi.
i have this code that works when done with a vbscript on a local machine that's connected to internet.
Code:
from_addr = "me@somwewhere.com"
to_addr   = "recipient@somwhereelse.com"
msg_subj  = "testing email with cdo"
msg_body  = "this is a test message"
Set myMail=CreateObject("CDO.Message")
myMail.Subject=msg_subj
myMail.From=from_addr
myMail.To=to_addr 
myMail.TextBody=msg_body
myMail.Send  
set myMail=nothing
but when i put this in the intranet using asp, it doesn't work:
Code:
<%
response.write "started program<br>" 
from_addr = "me@somewhere.com"
to_addr   = "recipient@somewhereelse.com"
msg_subj  = "testing email with cdo"
msg_body  = "this is a test message"
Set myMail=CreateObject("CDO.Message")
myMail.Subject=msg_subj
myMail.From=from_addr
myMail.To=to_addr 
myMail.TextBody=msg_body
myMail.Sendusing 
set myMail=nothing 
response.write "finished program<br>"
%>
any ideas why it's not working on the server?
thanks.
 
myMail.Sendusing ???????

Try using this:
Code:
<%
Set objMail = Server.CreateObject("CDO.Message")
Set objConf = Server.CreateObject("CDO.Configuration") 
Set objFields = objConf.Fields
With objFields
 .Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2
 .Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL]  = "SERVER IP HERE"
 .Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")[/URL] = 10 
 .Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25
 .Update 
End With

With objMail
 Set .Configuration = objConf
 .From = "FROM EMAIL ADDRESS"
 .Sender = "SENDER NAME"
 .To = "TO EMAIL ADRESS"
 .Subject = "SUBJECT"
 .HTMLBody = "BODY"
End With
    
Err.Clear 
objMail.Send
Set objFields = Nothing
Set objConf = Nothing
Set objMail = Nothing
%>
 
thanks so much, foxbox
i tried it and it works now.
but i'm puzzled why when we don't specify an smtp server on the vb script app and it works, but on the asp/intranet, we have to specify an smtp server and do all those config stuff.
any ideas?
thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top