ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 13th, 2003, 02:42 AM
pgokcen pgokcen is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 44 pgokcen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 29 sec
Reputation Power: 16
Mail Attachment using CDONTS

Hi;

the following code gives an "unspecified error" can you help me??
on line-->mailObj.AttachFile file1
<%

dim mailComp,mailObj,from,file1
file1=request.Form("file1")

mailComp="CDONTS"
set mailObj = Server.CreateObject("CDONTS.NewMail")
mailObj.BodyFormat = 0
mailObj.MailFormat = 0
mailObj.From = "Didem.Gultoprak@vestel.com.tr"
mailObj.To = "Pinar.Gokcen@vestel.com.tr"
mailObj.Subject = request.Form("subject")
mailObj.Body = request.form("notes")
mailObj.AttachFile file1

mailObj.Send
set mailObj=nothing
response.Write("Your files sent successfully")
%>

Reply With Quote
  #2  
Old August 13th, 2003, 03:25 AM
rdoekes rdoekes is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Strasbourg, France
Posts: 181 rdoekes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 20 sec
Reputation Power: 17
Send a message via AIM to rdoekes Send a message via Yahoo to rdoekes
FileUpload is needed (Binary processing)

I suppose the attachment is a file on the client computer. Therefore you need to upload the file first, with either an upload component or a self made upload component. (remember multipart form)

Then you can hook the attachment to the email.
__________________
- Rogier Doekes

Reply With Quote
  #3  
Old August 13th, 2003, 04:09 AM
pgokcen pgokcen is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 44 pgokcen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 29 sec
Reputation Power: 16
upload is ok but ??

hi;

am sending you 2 documents
1-mail sending (asp code)
2-form

first it gave an error on line
........CreateTextFile(FileName)

then I diabled it and related lines

after it gave an error on line 125 ....AttachFile .....
(an unspecified error)

please help me!!
Attached Files
File Type: zip files.zip (2.7 KB, 1468 views)

Reply With Quote
  #4  
Old August 13th, 2003, 09:33 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Posts: 2,056 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 44 m 22 sec
Reputation Power: 0
As rdoekes has already mentioned, the file you are trying to attach must be on the server. The easiest way to achieve this is to use a file-uploading component. I've been using one from Soft Artisans for the last 5 years, called SAFileup - but there are plenty to choose from.

Once you have done that, here's some sample code taken from 4guysfromrolla.com
Code:
<%
  Option Explicit

  Dim objMail
  Set objMail = Server.CreateObject("CDONTS.NewMail")

  objMail.From = "friend@somewhere.com"
  objMail.Subject = "A message TO you"
  objMail.AttachFile("d:\images\pic.gif")
  objMail.To = "someone@someplace.com"
  objMail.Body = "This is the body of the Message"
  objMail.Send

  Response.write("Mail was Sent")

  'You should always do this with CDONTS.
  set objMail = nothing
%>
Link to SA Fileup

Something else to note: If you are using IIS v.5+ (Windows 2000 onwards), you should be using CDOSYS for all your mailing, as CDONTS has been phased out and no longer ships with IIS.

Reply With Quote
  #5  
Old May 10th, 2006, 04:50 AM
asitti asitti is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 1 asitti User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 43 sec
Reputation Power: 0
Smile Supplying the Mailserver

Hi you must supply the Mailserver before you intend to send a mail. How should the system know about the mailserver if you don't tell it :-).


Quote:
Originally Posted by pgokcen
Hi;

the following code gives an "unspecified error" can you help me??
on line-->mailObj.AttachFile file1
<%

dim mailComp,mailObj,from,file1
file1=request.Form("file1")

mailComp="CDONTS"
set mailObj = Server.CreateObject("CDONTS.NewMail")
mailObj.BodyFormat = 0
mailObj.MailFormat = 0
mailObj.From = "Didem.Gultoprak@vestel.com.tr"
mailObj.To = "Pinar.Gokcen@vestel.com.tr"
mailObj.Subject = request.Form("subject")
mailObj.Body = request.form("notes")
mailObj.AttachFile file1

mailObj.Send
set mailObj=nothing
response.Write("Your files sent successfully")
%>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > Mail Attachment using CDONTS


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap