asp CDONTS attachment not being sent correctly

R

Ryan McLean

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"), "(e-mail address removed)", "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_Information.html
C:\webs\gearup\gearupqa\reporttemp\Academic_Information.html

Thanks again!
 
R

Ryan McLean

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
 
R

Ryan McLean

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,233
Latest member
AlyssaCrai

Latest Threads

Top