responding with Email in ASP

How does someone automatically send an email to a person using ASP.  Do you need 3rd party software or is it all in IIS.

More specifially, I have a database of users email address and would like to be able to email them to remind them their password.

Seems like a very common aplication for ASP however I have found nothing on it.

If there such thing as an SMTP objcet?
gdeanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mberumenCommented:
There are multiple email components out there you might want to try ASPEmail at http:\\www.aspemail.com, alternatively you could use CDO

This is a sample use of ASPEMAIL

Set Mail = Server.CreateObject("Persits.MailSender")
     
     Mail.Host = "172.16.198.203" ' Specify a valid SMTP server
     Mail.From = "westregionoss@nextel.com "   ' Specify sender's address
     Mail.FromName = "NTM" ' Specify sender's name
     mail.addaddress ossemail
     Mail.Subject = ""HELLO"
     Mail.Body="email content goes here"
Mail.isHTML=false
     On Error Resume Next
     Mail.Send
     If Err <> 0 Then
     Response.Write "Error encountered: " & Err.Description
           End If
     
     
     set mail=nothing
0
gdeanAuthor Commented:
So The operation requires thirda party software?
0
gdeanAuthor Commented:
Are there any free applications available?
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

mgfranzCommented:
Yes, CDO is installed with SMTP, (or is it installed with MDAC...)  I can't remember;

' Create the mailing object
Set objCDOAdmin = Server.CreateObject("CDO.Message")

     With objCDOAdmin
          .AutoGenerateTextBody = True ' Make a text message if needed
          .To       = rs_email 'toaddress
          .From     = "me@myself.com" ' From
          .Subject  = strSubject ' Subject
          .HtmlBody = strBody ' HTML Coded body
          .Send ' Finally send the message
     End With

' We don't want to halt if an error is encountered
On Error Resume Next
' We want to see what the error is!  ;-)
If Err <> 0 Then
     Response.Write "Error encountered: " & Err.Description
Else
     ' Response.Write "Message Sent"
End If

Response.Write FormatNumber(rs_ID, 0) & " messages sent."
' Finally, close the mail object
Set objCDOAdmin = Nothing
0
mberumenCommented:
BTW as far as I know ASPEmail is free.. Or it used to be

0
gdeanAuthor Commented:
I get this error mgfranz

CDO.Message.1 (0x80040220)
The "SendUsing" configuration value is invalid.
/LostPW.asp, line 10
0
mgfranzCommented:
Post your code.
0
gdeanAuthor Commented:
    Set objCDOAdmin = Server.CreateObject("CDO.Message")
     with objCDOAdmin
          .AutoGenerateTextBody = True ' Make a text message if needed
          .To = "grdean@vt.edu" 'toaddress
          .From = "grdean@vt.edu" ' From
          .Subject = "strSubject" ' Subject
          .HtmlBody = "strBody" ' HTML Coded body
          .Send ' Finally send the message
     End With

     ' We don't want to halt if an error is encountered
     On Error Resume Next
     ' We want to see what the error is!  ;-)
     If Err <> 0 Then
          Response.Write "Error encountered: " & Err.Description
     Else
          Response.Write "Message Sent"
     End If

     Response.Write FormatNumber(rs_ID, 0) & " messages sent."
     ' Finally, close the mail object
     Set objCDOAdmin = Nothing
0
gdeanAuthor Commented:
I need to tell it how to send the mail ie what server to use ....correct?  where do I do thtat?
0
mgfranzCommented:
Read my comments on the MSDN links... I'm guessing that you have Exchange running on the server, right?
0
gdeanAuthor Commented:
no exchange is not running.  Can't it be doen without exchange?
0
mgfranzCommented:
Yes.  But the error you are getting is a direct error to the Exchange SP3 being installed.  You are running Winndows 2000 right?

Try this, it will work on NT;

Set objCDO = Server.CreateObject("CDONTS.NewMail")
objCDO.From = "xyz@internet.com"
objCDO.To = "abc@btinternet.com"
objCDO.cc = ""
objCDO.Subject = "Request for software"
objCDO.Body = mailFormat
objCDO.Send
Set objCDO = Nothing
0
gdeanAuthor Commented:
Well I am running XP pro
0
gdeanAuthor Commented:
Do i need to configure the SMTP server for IIS with the proper SMTP address?  Would that cause the error.  If so where / How do i do that
0
mgfranzCommented:
SMTP needs to be installed yes.
0
gdeanAuthor Commented:
Its installed, Im just not sure hw it needs to be configured.  Also i think I noticed, in the links you posted,  something about having Outlook 2002 installed having the same effect that Exchange SP3.  But i think that article only applies to Windos 2k.  

I looked at the properties for SMTP Virtual host and I really dont know what i need.  It seems like I should have to specify an mail server somewhere for outgoing mail.  Do you have any insight to that?

With XP do i need the CDO or CDONTS?
0
mgfranzCommented:
CDO or CDONTS works with IIS5.1

There aren't any properties to set to make CDO work.
0
gdeanAuthor Commented:
How does the CDo object know what mail server to use?
0
mgfranzCommented:
It will use SMTP from the server that the page is being called from.
0
gdeanAuthor Commented:
I have followed mgfranz's coding suggestion however run into a problme because Outlook XP (Outlook 2002) is also installed on the machine.  The workarounds provided in the following link have led to no conclusions.

I am going to increase the points for this question and now ask for advice on how to solve this problem. please view the link for more details.

Here is the following code i used to try to correct the issue but to no prevail:

Const cdoSendUsingPort = 25
    Const strSmartHost = "smtp.blacksburg.ntc-com.net"
     Set objCDO = Server.CreateObject("CDO.message")
     objCDO.From = "blah"
     objCDO.To = "blah"
     objCDO.cc = ""
     objCDO.Subject = "Request for software"
    objCDO.Configuration.Fields.item("sendusing") = 1
    objCDO.Configuration.Fields.item("smtpserver") = strSmartHost
    objCDO.Configuration.Fields.item("smtpserverport") = cdoSendUsingPort
    objCDO.Configuration.Fields.Update

     objCDO.Send

http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B322338
0
mgfranzCommented:
I would say to try the SP3 update as detailed here? http://support.microsoft.com/default.aspx?scid=kb;EN-US;301378

But it's a 165mB download... quite unreasonable for a single .dll.  I wonder if you can .CAB the dll Cdoex.dll 6.0.5770.96 from a disk of from somewhere on the web.

Here is something I found that has some interest...
"If Office XP or Sharepoint Portal or Team Server or Exchange 2000 is installed on machine then CDOEX.DLL is registered instead of cdosys.dll, otherwise CDOSYS.DLL registered.  Registering one un-registers the other one."

Try unregistering the cdoex.dll and then see if the cdosys.dll registered, try the different samples then.

0
engineroomCommented:
why don't you try a simple script to see if your cdonts works.

<%

set cdoObj = server.createObject("cdonts.newMail")
cdoObj.To = "anemailyouhave@hotmail.com" ' use an outside source to see if you get the message.
cdoObj.from = "mySelf" 'there must be no spaces the from field
cdoObj.subject = "This is your subject"
cdoObj.body = "this is your body"
cdoObj.send

set cdoObj = nothing

%>

run this script through your server. if this works then we know cdo works..  

http://localhost/cdoTest.asp

try that and if it works, well do the rest. Emailing to everyone in your database.

:)
0
gdeanAuthor Commented:
The CDONTS will not work.  "Invalid class string".  In fact I believe that they dont work with XP...not sure but i thought I read that somewhere.

As far as the SP3 goes I dont understand why they recommend that as the article specifies that the user doesn't have exchange installed.  
0
DRY_GINCommented:
same question has been raised and answer has been accepted here:
http://www.experts-exchange.com/Operating_Systems/WinXP/Q_20440413.html
0
DRY_GINCommented:
addition:
here is a direct link to CDONTS.dll :

http://crt.doce.lsu.edu/CRT-HTML-Class/Lesson29a.html
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gdeanAuthor Commented:
I am assuming that you are suggesting that i regiter CDONTS.dll and just use CDONTS....?
0
DRY_GINCommented:
Hello, thanks for acception of my answer,
Here is nice function for all you e-mail needs
Note: if you have too many emails to send - it is better to split emails on groups by let's say 25 e-mails with up to 20 recepients in each (I'm not sure about actual limitations)
and to keep self-refreshing your asp file with ID of last sended mail as a parameter. You can even design "nice progress bar" so it will look like a real mass-mailer ;)

If you want users to do not see each other:

In TO field put something like "My Web Site Customers"
In CC field - do not put anything
In BCC field put list of emails splitted by ";"
It is important that "From" email should exist (registered)
you can use "Replay-To" email for answers and it could be different from "From" e-mail.


function SendMail(sTo, sFrom,sCC,sBCC, sPriority, sSubject, sBody, bHTML,replemail)
 on error resume next
    Const cdoLow = 0
    Const cdoNormal = 1
    Const cdoHigh = 2
    Const CdoBodyFormatText = 1
    Const CdoMailFormatText = 1
    Set oMailMessage = server.CreateObject("CDONTS.NewMail")
    oMailMessage.To = sTo
    oMailMessage.Bcc = sBCC    
    oMailMessage.Cc = sCC
    oMailMessage.To = sTo
    oMailMessage.Value("Reply-To") = replemail  
    oMailMessage.From = sFrom
    sPriority = ucase(sPriority)
    if sPriority = "LOW" then
        oMailMessage.importance = cdoLow
    elseif sPriority = "HIGH" then
        oMailMessage.importance = cdoHigh
    else
        oMailMessage.importance = cdoNormal
    end if    
    if bHTML then 'this is mail format (plain text or html)
        oMailMessage.BodyFormat = CdoBodyFormatText
        oMailMessage.MailFormat = CdoMailFormatText
    end if
    oMailMessage.Body = replace(sBody,"|",chr(13) & chr(10))
     oMailMessage.Subject = sSubject
    oMailMessage.Send
    set oMailMessage = nothing
    if Err then
        SendMail = false
        err.clear
    else
        SendMail = true
    end if
On error goto 0
end function

comment: I'm using "|" as line separator in e-mail body instead of Chr(13) & chr(10) to make everything easy to use

Good luck
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.