Sending email with ASP

hassaan

[HassaaN]
Local time
Today, 15:38
Joined
Jul 7, 2005
Messages
14
I am using the following code to send email with ASP but I get an error which says:

Server.CreateObject Failed

emailsend.asp, line 5



<%
For Each x In Request.Form
message = "my message"
Next
set smtp=Server.CreateObject("Bamboo.SMTP")
smtp.Server="webmail.mywebsite.com"
smtp.Rcpt="receiver@hisdomain.com"
smtp.From="webmaster@mydomain.com"
smtp.FromName="Webmaster"
smtp.Subject="Test Mail"
smtp.Message = message
on error resume next
smtp.Send
if err then
response.Write err.Description
else
Response.redirect ("http://mywebsite.com")
end if
set smtp = Nothing
%>


Help please!!!!
 
That usually means that the object hasn't been installed on the server you're trying to create it from or you're object reference is incorrect.
 
My new code and new problem!

This is the new code i used:

<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Test Mail Subject"
myMail.From="webmaster@mydomain.com"
myMail.To="receiver@domain.com"
myMail.Bcc="receiver@domain.com"
myMail.TextBody="This is a message."
myMail.Send
set myMail=nothing
%>


I get an error on executing this file that myMail.Send failed (line 8)
I asked my webhosting compnay, they said that they support CDOSYS used in this code, howver for coding issues, ask someone specific.
Please help!!!!
 
when in asp you must use server.createobject

Set myMail=Server.CreateObject("CDO.Message")
 
Thanks a loT!!!

well i did add server to that - made it server.createobject

now i get a new error - it says:
The "SendUsing" configuration value is invalid. (line 8)
 
I used the new code as quoted on the above link

the new error that i get is:
error '8004020f' (line 20)

please help!!!
btw my hosting company said they used windows 2000 server
 
well.... all the errors that i was coming across have finally been resolved!

now i would like to ask one more thing...
is there a way i can send emails to anyone with a webpage in the email - like the newsletters that one gets often. i should just need to specify the URL in the script and it should show that URL to whosoever the mail was sent. i know how to send HTML in the mail that is with HTMLBody but what I would like to know is to how to send HTML pages in emails.
this way, i can send emails without having to change script everytime - i will just need to update the page which is being sent.
help!
 
yes,
make an html template and use the file system object to read the html text of that template to a stream and save it as a string. use that string as the body of the email.
 

Users who are viewing this thread

Back
Top Bottom