469,360 Members | 1,782 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,360 developers. It's quick & easy.

asp CDONTS attachment not being sent correctly

Hello everyone! I have a question for ya'll. In a web-based asp
application I am creating and (attempting to) attach a file. The
email sends correctly, but when I try to open the attachment, it is
blank. Now, I know you all are probably thinking that the file is
blank on the server or it doesn't exist at the address that I specify.
Well, I checked on the server and the file is there and there is
stuff in it. Could this be a permissions thing, or am I just writing
the syntax incorrectly?

Thanks in advance for any assistance.

Ryan

p.s. Here is some code (notice the response.writes at the bottom of
each sub, they print the same stuff):

call subFileCreate("/gearupqa/reporttemp/",
"Academic_Information.html", strBody)
call subEmail(request.form("txtEmail"), "ge****@nau.edu", "Here is the
report that you requested.", "/gearupqa/reporttemp/",
"Academic_Information.html", "GEAR UP Administration : Academic
Information Page")
sub subEmail(dest, orig, mail_body, path, file_name, subj)
Set objMail = CreateObject("CDONTS.Newmail")
objMail.From = orig & "<GearUp>"
objMail.To = dest & "<" & dest & ">"
objMail.Subject = subj
objMail.AttachFile server.mappath(path & file_name),
file_name objMail.Body = mail_body
objMail.BodyFormat=0 '0 HTML, 1 plain text
objMail.MailFormat=0 '0 MIME format, 1 plain text
objMail.Send()
Set objMail = nothing
response.write(server.mappath(path & file_name) & "<br>")
end sub

sub subFileCreate(path, file_name, text)
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
Set InStream = FileObject.OpenTextFile(server.mappath(path &
file_name), 8, TRUE, -2)
InStream.WriteLine(text)
set InStream = nothing
set FileObject = nothing
response.write(server.mappath(path & file_name) & "<br>")
end sub

Here are the printed paths:
C:\webs\gearup\gearupqa\reporttemp\Academic_Inform ation.html
C:\webs\gearup\gearupqa\reporttemp\Academic_Inform ation.html

Thanks again!
Jul 19 '05 #1
3 4544
Try a page with JUST the e-mail code, no sub, and hard-code all the values
once. This will tell you where to start.

Also, look at CDO instead of CDONTS while you are at it. CDONTS it being
phased out.

--
----------------------------------------------------------
Curt Christianson (Software_AT_Darkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
...Offering free scripts & code snippits for everyone...
---------------------------------------------------------

"Ryan McLean" <rd***@dana.ucc.nau.edu> wrote in message
news:df*************************@posting.google.co m...
Hello everyone! I have a question for ya'll. In a web-based asp
application I am creating and (attempting to) attach a file. The
email sends correctly, but when I try to open the attachment, it is
blank. Now, I know you all are probably thinking that the file is
blank on the server or it doesn't exist at the address that I specify.
Well, I checked on the server and the file is there and there is
stuff in it. Could this be a permissions thing, or am I just writing
the syntax incorrectly?

Thanks in advance for any assistance.

Ryan

p.s. Here is some code (notice the response.writes at the bottom of
each sub, they print the same stuff):

call subFileCreate("/gearupqa/reporttemp/",
"Academic_Information.html", strBody)
call subEmail(request.form("txtEmail"), "ge****@nau.edu", "Here is the
report that you requested.", "/gearupqa/reporttemp/",
"Academic_Information.html", "GEAR UP Administration : Academic
Information Page")
sub subEmail(dest, orig, mail_body, path, file_name, subj)
Set objMail = CreateObject("CDONTS.Newmail")
objMail.From = orig & "<GearUp>"
objMail.To = dest & "<" & dest & ">"
objMail.Subject = subj
objMail.AttachFile server.mappath(path & file_name),
file_name objMail.Body = mail_body
objMail.BodyFormat=0 '0 HTML, 1 plain text
objMail.MailFormat=0 '0 MIME format, 1 plain text
objMail.Send()
Set objMail = nothing
response.write(server.mappath(path & file_name) & "<br>")
end sub

sub subFileCreate(path, file_name, text)
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
Set InStream = FileObject.OpenTextFile(server.mappath(path &
file_name), 8, TRUE, -2)
InStream.WriteLine(text)
set InStream = nothing
set FileObject = nothing
response.write(server.mappath(path & file_name) & "<br>")
end sub

Here are the printed paths:
C:\webs\gearup\gearupqa\reporttemp\Academic_Inform ation.html
C:\webs\gearup\gearupqa\reporttemp\Academic_Inform ation.html

Thanks again!

Jul 19 '05 #2
Hi Curt! Thank you for the fast response and assistance. I tried
what you suggested regarding the email code being executed using
hard-coded values outside of the routine on an asp page; sadly it was
of no avail.

I didn't know there was a cdo email . . . I'll have to look for some
information on it.

Thank you again for your help.

Ryan
Jul 19 '05 #3
Yay! The new CDO method worked perfectly! Thanks again!

Ryan

p.s. Is there any way to change the file name as it appears in the
email? I haven't seen any parameters that allow you to do that like
you can in cdonts.
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Chris Kennedy | last post: by
4 posts views Thread by Jason Steeves | last post: by
7 posts views Thread by Paul | last post: by
reply views Thread by jbguernsey | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.