code for mail attachment

code for mail attachment

am 19.09.2007 10:46:25 von vinodkus

dear sir/madam
I m developing a program for mail attacment but i got an error
error '80004005'
/mail1.asp, line 24
. Please help me.
<%
Set newmail = server.CreateObject ("cdonts.newmail")
txtTo = request.form("txtTo")
txtFrom = request.form("txtFrom")
txtSub = request.form("txtSub")
file1 = request.form("file1") ''''''''''''''''''''''''''' error line
newmail.bodyformat = 0
newmail.mailformat = 0
newmail.from = txtFrom
newmail.to = txtTo
newmail.subject = txtSub

If file1 <> "" then
newmail.AttachFile(file1)
End If

newmail.body = "Dear Sir I am sending my mail"
newmail.send
Set newmail = Nothing

%>
Thanks in advance

Re: code for mail attachment

am 19.09.2007 14:43:55 von Mike Brind

wrote in message
news:1190191585.106920.84230@57g2000hsv.googlegroups.com...
> dear sir/madam
> I m developing a program for mail attacment but i got an error
> error '80004005'
> /mail1.asp, line 24
> . Please help me.
> <%
> Set newmail = server.CreateObject ("cdonts.newmail")
> txtTo = request.form("txtTo")
> txtFrom = request.form("txtFrom")
> txtSub = request.form("txtSub")
> file1 = request.form("file1") ''''''''''''''''''''''''''' error line
> newmail.bodyformat = 0
> newmail.mailformat = 0
> newmail.from = txtFrom
> newmail.to = txtTo
> newmail.subject = txtSub
>
> If file1 <> "" then
> newmail.AttachFile(file1)
> End If
>
> newmail.body = "Dear Sir I am sending my mail"
> newmail.send
> Set newmail = Nothing
>
> %>
> Thanks in advance
>

You have a space in your variable name: file 1. That's not legal. Close
the space.

Also, CDONTS was deprecated about 7 years ago. You should be using CDO.

http://classicasp.aspfaq.com/email/how-do-i-send-e-mail-with -cdo.html

--
Mike Brind