Link to home
Start Free TrialLog in
Avatar of lentzi
lentzi

asked on

How can I send email with ASP?

How can I send email with ASP?
The code listed below gives me an error like this:

Error Type:
Server object, ASP 0177 (0x800401F3)
Invalid ProgID. For additional information specific to this message please visit the Microsoft Online Support site located at: http://www.microsoft.com/contentredirect.asp.

I have installed a Virtual SMTP server on my IIS server, I have access to a real linux SMTP server, which is not on my server machine, please help me guys?!
<%
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "smtp.smtp-server.com" ' Specify a valid SMTP server
Mail.From = "sales@veryhotcakes.com" ' Specify sender's address
Mail.FromName = "VeryHotCakes Sales" ' Specify sender's name

Mail.AddAddress "andy@andrewscompany.net", "Andrew Johnson, Jr."
Mail.AddAddress "paul@paulscompany.com" ' Name is optional
Mail.AddReplyTo "info@veryhotcakes.com"
Mail.AddAttachment "c:\images\cakes.gif"

Mail.Subject = "Thanks for ordering our hot cakes!"
Mail.Body = "Dear Sir:" & Chr(13) & Chr(10) & _
    "Thank you for your business."

On Error Resume Next
Mail.Send
If Err <> 0 Then
  Response.Write "Error encountered: " & Err.Description
End If
%>
Avatar of liebrand
liebrand
Flag of United States of America image


Its pretty straight forward... do the following:

<%

set oMail = server.createobject("CDONTS.NewMail")

oMail.from = "from@email.com"
oMail.to = "to@email.com"
oMail.subject = "The subject line"
oMail.Body = "The body of the email"
oMail.Send

%>

Avatar of dredge
dredge

liebrands's solution required that you have an SMTP server setup inside of IIS - this is not a band thing, it's just one alternative.

i prefer to use JMail from Dimac. http://tech.dimac.net - it's a free email component that i find easier to use than CDONTS, and more powerful as well.

that's just my opinion. alot of people use CDO and CDONTS - it works great. i just prefer JMail.
ASKER CERTIFIED SOLUTION
Avatar of Michel Sakr
Michel Sakr
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you are running IIS5 on W2K you don't even need an SMTP server, just the SMTP Service...
hi lentzi,

i just want to make sure... have you registered the persits mail component or dll on your web server? this is achieved by running windows' regsvr32 and passing to it as a parameter the absolute pathname of the dll. if yes, try rebooting your server if you also haven't done this.

anyway, your invalid progid error just says that our asp engine could not find the persits.mailsender programmatic id in the registry.