473,792 Members | 2,807 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Infor mation.html", strBody)
call subEmail(reques t.form("txtEmai l"), "ge****@nau.edu ", "Here is the
report that you requested.", "/gearupqa/reporttemp/",
"Academic_Infor mation.html", "GEAR UP Administration : Academic
Information Page")
sub subEmail(dest, orig, mail_body, path, file_name, subj)
Set objMail = CreateObject("C DONTS.Newmail")
objMail.From = orig & "<GearUp>"
objMail.To = dest & "<" & dest & ">"
objMail.Subject = subj
objMail.AttachF ile server.mappath( path & file_name),
file_name objMail.Body = mail_body
objMail.BodyFor mat=0 '0 HTML, 1 plain text
objMail.MailFor mat=0 '0 MIME format, 1 plain text
objMail.Send()
Set objMail = nothing
response.write( server.mappath( path & file_name) & "<br>")
end sub

sub subFileCreate(p ath, file_name, text)
Set FileObject = Server.CreateOb ject("Scripting .FileSystemObje ct")
Set InStream = FileObject.Open TextFile(server .mappath(path &
file_name), 8, TRUE, -2)
InStream.WriteL ine(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\report temp\Academic_I nformation.html
C:\webs\gearup\ gearupqa\report temp\Academic_I nformation.html

Thanks again!
Jul 19 '05 #1
3 4667
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_Da rkfalz.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.goog le.com...
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_Infor mation.html", strBody)
call subEmail(reques t.form("txtEmai l"), "ge****@nau.edu ", "Here is the
report that you requested.", "/gearupqa/reporttemp/",
"Academic_Infor mation.html", "GEAR UP Administration : Academic
Information Page")
sub subEmail(dest, orig, mail_body, path, file_name, subj)
Set objMail = CreateObject("C DONTS.Newmail")
objMail.From = orig & "<GearUp>"
objMail.To = dest & "<" & dest & ">"
objMail.Subject = subj
objMail.AttachF ile server.mappath( path & file_name),
file_name objMail.Body = mail_body
objMail.BodyFor mat=0 '0 HTML, 1 plain text
objMail.MailFor mat=0 '0 MIME format, 1 plain text
objMail.Send()
Set objMail = nothing
response.write( server.mappath( path & file_name) & "<br>")
end sub

sub subFileCreate(p ath, file_name, text)
Set FileObject = Server.CreateOb ject("Scripting .FileSystemObje ct")
Set InStream = FileObject.Open TextFile(server .mappath(path &
file_name), 8, TRUE, -2)
InStream.WriteL ine(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\report temp\Academic_I nformation.html
C:\webs\gearup\ gearupqa\report temp\Academic_I nformation.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2547
by: maher | last post by:
Hi I am using the CDONTS.newmail object to send file as an attachment so I used attachfile method. it seems the attach file wont work if the file size more than 100 KB , does anybody know if there is a size limit or where to change it I am using the SMTP server included with IIS 5.0. PS when file is sent, it will show on the EMAIL as an attachment only with 0 bytes.
2
6297
by: Kyle Pula | last post by:
I am using CDONTS to send email from an ASP script. Attached to each of these emails is a 34K PDF file. 90% of the time the file arrives intact. 10% of the time, however, users are unable to open the file. It appears that users using some sort of webmail recieve an improperly decoded version of the file where as users of POP3 non-web email clients (e.g. Outlook) generally recieve the file intact.
1
1271
by: Chris Kennedy | last post by:
I have a web application which saves files to a server and emails the file as an attachment. I generate a unique name for each file by concatenating a unique numeric string so the file name is unique and cannot be accidentally be overwritten. I also store the original name of the file. Is there any way to rename the attachment when I send it so it doesn't have the unique name but rather the orignal one.
2
1888
by: Jammer | last post by:
Can someone give me some sample code to use CDONTS.new to send email with an attachment? I've got sample code from the following website; http://msdn.microsoft.com/library/en-us/cdo/html/_denali_newmail_object_cdonts_library_.asp?frame=true But, I'm having trouble GETTING the relevant field from my HTML form! I can't seem to be able to get the field property. :( It just comes up as a blank.
5
2637
by: BaWork | last post by:
I have a web form where a client can select which site members to send an email to. This form is populated from the contents of the member table, so the form can have 0-x names listed on it depending on member expiration dates. When the form is submitted, the code loops through the form contents and sends an email to those members that meet the selected criteria. All this worked perfectly when I was sending text emails, but since I
6
11189
by: DigitalRick | last post by:
I have been running CDONTS in my ASPpages to send emails to me sent from my guestbook. It had been working fine untill I upgraded to Server 2003 (I am also running Exchange 2003) all locally. I will include the code I originally used. I understand I should switch from CDONTS to CDO mail but after several sttempts I am finding a very hard time getting the new CDO mail to work properly. Any assistance with this would be greatly...
4
1873
by: Jason Steeves | last post by:
I am using cdonts to send mail messages with an attachment. The problem I am having is the messages are going through OK but the attachments are not there. Any ideas? I have tried my code elsewhere and it looks OK...........Jason
7
2890
by: Paul | last post by:
I have just started work on a system using CDONTS to mail out. Whilst this is fine on the server, my local development machine is using XP Pro with IIS5.1 installed. Is there a way I can get the functionality of cdonts so that I can test/develop on my local machine, preferably without actually sending any mail to the persons involved.
0
1594
by: jbguernsey | last post by:
I am hoping to be able to avoid the Outlook security problem by using CDONTS and I tried using the code below (with appropriate change to the address etc): Dim oEMail As New CDONTS.EMail oEMail.From "anyn...@anydomain.com" oEMail.To "yourem...@yourdomain.com" oEMail.BodyFormat = CdoBodyFormatText oEMail.Body = "Insert some useful text here"
0
9670
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9518
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10159
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9033
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3719
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2917
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.