# Sending email with asp & cdosys

**URL:** <https://forum.kirupa.com/t/sending-email-with-asp-cdosys/213436>\
**Category:** Uncategorized\
**Created:** [January 19, 2007, 3:45pm UTC](https://forum.kirupa.com/t/sending-email-with-asp-cdosys/213436 "2007-01-19T15:45:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![acc](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@acc](https://forum.kirupa.com/u/acc)\
**Post date:** [January 19, 2007, 3:45pm UTC](https://forum.kirupa.com/t/sending-email-with-asp-cdosys/213436/1 "2007-01-19T15:45:50Z")

</div>

I found this script to send emails from our server, which I later intend to use to send confirmation emails to people who have filled out a form from our site.

It works fine, if the case is this:

ObjSendMail.To = "someoesEmail@ourDomain.com"  
ObjSendMail.Subject = “this is the subject”  
ObjSendMail.From = "myEmail@ourDomain.com"

But won’t send like this:

ObjSendMail.To = "someonesEmail@theirDomain.com"  
ObjSendMail.Subject = “this is the subject”  
ObjSendMail.From = "myEmail@ourDomain.com"

I’m new to all of this, so if anyone can shine some light to this, would be great.  
Thanks!

The complete script is below

```auto

<%
Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message") 
     
'This section provides the configuration information for the remote SMTP server.
     
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.ourdomain.com"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
     

     
ObjSendMail.Configuration.Fields.Update
     

ObjSendMail.To = "someonesEmail@theirDomain.com"
 ObjSendMail.Subject = "this is the subject"
 ObjSendMail.From = "myEmail@ourDomain.com"
     
ObjSendMail.HTMLBody = "this is the body"
     
ObjSendMail.Send
     
Set ObjSendMail = Nothing 

Response.Write "your email has been sent"
%>

```
