Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 23rd, 2004, 08:49 AM
Friend of Wrox
Points: 1,035, Level: 12
Points: 1,035, Level: 12 Points: 1,035, Level: 12 Points: 1,035, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , USA.
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jmss66
Default Attach E-mail in CDONTS

I have this program working fine if I don't send any attachment. Once I do I encounter this error which line 69 is

         objMsg.Attachfile FileAttachment


Error Type:
Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method
/hfrrf/Administrator_email.asp, line 69



Can someone please help me figure out why I am encountering this problem.

Thanks,
Judy
<%

FileAttachment = Session("uploadfilename")

SUBMITTED = Request.Form("SUBMITTED")
If SUBMITTED = "TRUE" Then
  COMMENTS = Request.Form("COMMENTS")


' build email message
 MM = Chr(10) & Chr(13)
 MM = COMMENTS

' build mailing list

Set oRSMem=Server.CreateObject("ADODB.Recordset")
sqlString= "SELECT EmailAddress FROM Member WHERE MailingList = True;"
oRSMem.Open sqlString, objConn
MailList = ""

Do While NOT oRSMEM.EOF
MailList = MailList & oRSMem("EmailAddress") & ";"
oRSMem.MoveNext
Loop

oRSMem.Close
Set oRSMem = Nothing

Set objMsg = Server.CreateObject("CDONTS.NewMail")
objMsg.From = "MemberServices@jsese.org"
objMsg.BCC = MailList
objMsg.Subject = "Fund News Update"
objMsg.Body = MM
If Session("UploadFileName") <> " " Then
objMsg.Attachfile FileAttachment
End If
objMsg.Send
Set objMsg = Nothing

URL = "Administrator.asp"
Response.Redirect(URL)

End If
%>
  #2 (permalink)  
Old March 23rd, 2004, 09:49 AM
Friend of Wrox
Points: 1,035, Level: 12
Points: 1,035, Level: 12 Points: 1,035, Level: 12 Points: 1,035, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , USA.
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jmss66
Default

I was able to make it work. The problem was I was not pointing it to the right directory.

Now I have another question. If I have more than one attachment, how do you go about it. Also what is the right way to capture more than one attachment? Let's say for example I have a Session Variable called uploadfilename and this has two filenames in it File1 and File2. Should I have captured the Filenames as File1,File2 separate them with a comma? I guess I need help on how to capture multiple attachments and how to send them.

Thanks,
Judy

  #3 (permalink)  
Old March 23rd, 2004, 09:02 PM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Judy,
You seem to be heading in the right direction anyway.
You could seperate the file names as mentioned with a comma.
Split() the variable into an array.
Loop through the array attaching the files.


======================================
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
  #4 (permalink)  
Old March 24th, 2004, 10:19 AM
Friend of Wrox
Points: 1,035, Level: 12
Points: 1,035, Level: 12 Points: 1,035, Level: 12 Points: 1,035, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , USA.
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jmss66
Default

Can you please show me a sample on how to split the variable into an array? If there are any websites you recommend me checking out I would appreciate it.
============================================
Split() the variable into an array.
Loop through the array attaching the files.
============================================

Thanks for your help.

Judy

  #5 (permalink)  
Old March 24th, 2004, 12:46 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

array = Split(string, delimeter)

aryMyFiles = Split("file1,file2,file3", ",")
  #6 (permalink)  
Old March 24th, 2004, 01:30 PM
Friend of Wrox
Points: 1,035, Level: 12
Points: 1,035, Level: 12 Points: 1,035, Level: 12 Points: 1,035, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , USA.
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jmss66
Default

Thanks. I was able to get it to attach and e-mailed. The next problem I encountered was when I sent a test e-mail to myself and opened it in my earthlink account over the web seems like the files were being sent with Hex. When I opened it in Outlook Express or MS Outlook I did not encounter this problem. Is there something that I need to do so people openning this e-mail will see the files as attachments and the content of the files not being displayed as Hex or bunch of numbers and alphabets?

Thanks,
Judy

  #7 (permalink)  
Old March 24th, 2004, 10:19 PM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Not sure sorry,
Try adding
Code:
objMsg.MailFormat = 0

======================================
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
  #8 (permalink)  
Old March 25th, 2004, 10:29 AM
Friend of Wrox
Points: 1,035, Level: 12
Points: 1,035, Level: 12 Points: 1,035, Level: 12 Points: 1,035, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , USA.
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jmss66
Default

That worked. Thanks again for the help.

  #9 (permalink)  
Old March 25th, 2004, 09:18 PM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

No problem,
I am not 100% on this myself but it is something to do with setting the mail format to MIME, which is acceptable to most mail servers.

Maybe one of the others can provide some background to Judy and myself?

======================================
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================


Similar Threads
Thread Thread Starter Forum Replies Last Post
Attach multiple files in mail using jsp deepakgoel Pro JSP 3 October 26th, 2007 12:19 AM
Missing mail content with CDONTS sunile-zest Classic ASP Basics 1 July 10th, 2007 02:22 PM
CDONTS ASP Mail Code egerdj Classic ASP Basics 0 February 19th, 2004 10:25 PM
Sending both text mail and HTML mail - CDONTS madhukp Classic ASP Basics 1 October 8th, 2003 01:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.