Solved

Attach image file to mailto form

Posted on 2001-06-20
14
1,260 Views
Last Modified: 2007-12-19
  How do I get a mailto form open a box or whatever to allow image to be attached to emailed form before sending?
0
Comment
Question by:Bob Stone
  • 5
  • 3
  • 3
  • +2
14 Comments
 
LVL 15

Expert Comment

by:a.marsh
Comment Utility
The only way you can do it with mailto is by simply creating the email message for the user and leaving it open so that they can attach the file and then click send.

To do that, set up a mailto: link e.g.

<a href="mailto:name@address.com">send email</a>

You can't do it by using mailto with forms...

Ant
0
 
LVL 15

Expert Comment

by:a.marsh
Comment Utility
For more info on mailto i.e. how to specify a subject, CC etc. look at:

http://developer.netscape.com/viewsource/husted_mailto/mailto.html

For much more control you will need to use a server-side script - I have done the kind of thing you are asking in PHP - it isn't that difficult. You just need to make sure you have a webserver that supports server-side scripting!!

Hope this helps.

Ant
0
 
LVL 33

Expert Comment

by:hongjun
Comment Utility
There's no way mailto can help you. As commented above, it can only allow you to state the To, Cc, Bcc, Subject, Body, etc simple attributes.

Please note that normal HTML will not be able to achieve sending an email with attachments. In HTML we use mailto and that only restricts us in the To, Cc, Bcc, Subject and Body field. To send an email with attachments, you need to use a server-side scripting language. I will show you how to do that in Active Server Pages (ASP). That means you will need a web server.

If you are using Win NT or Win 2000 and have CDONTS.dll installed, then you can do the following using Internt Information Server (IIS) as your web server.
<%
Dim objMailer
Dim strBody

' You can have HTML tags here
' You can therefore customize the format you want to send
strBody = "<TABLE BORDER='0'><TR><TD>Hello</TD><TD>World</TD></TR></TABLE>"

Set objMailer = CreateObject("CDONTS.Newmail")
objMailer.From = "sender@domain.com"
objMailer.To = "receipent@domain.com"
objMailer.Subject = "Your subject here"
objMailer.BodyFormat = 0
objMailer.Mailformat = 0
objMailer.Body = strBody
objMailer.Send
Set objMailer = Nothing
%>

If you do not have IIS, then you will need to download a web server and I recommend you using Personal Web Server (PWS). Download it at http://www.microsoft.com/ntserver/nts/downloads/recommended/nt4optpk/default.asp. Note that PWS will not be able to support CDONTS.

If you are using other versions of Windows, then you got to install a server component. I recommend using AspEmail. It can be downloaded from http://www.aspemail.com
To learn how to code using the AspEmail component, you can download its user manual from the site itself. It is very comprehensive and complete. There's even an asp example page showing that.

Good Luck
hongjun
0
 
LVL 33

Expert Comment

by:hongjun
Comment Utility
The below is the syntax of attaching a file.

objNewMail.AttachFile(Source [, FileName] [, EncodingMethod] )

To send multiple files, simply repeat the above coding many times while changing the file to be sent.

hongjun
0
 
LVL 33

Expert Comment

by:hongjun
Comment Utility
Use the below example code to do email sending in AspEmail.

<%
   Dim objMail

   Set objMail = Server.CreateObject("
   objMail.Host = "your_smtp"  ' SMTP Outgoing Server
   objMail.Port = 25  ' Optional (Default is 25)
   objMail.From = "sender@domain.com" ' From Address
   ' Optional but is recommended
   objMail.FromName = "Sender Name"
   ' Name is optional
   objMail.AddAddress "receipent1@domain.com", "Receipent1"
   objMail.AddAddress "another_pple@hotmail.com", "Another Person"
   ' CC Address (Optional)
   objMail.AddCC "cc_person@hotmail.com"
   ' BCC Address (Optional)
   objMail.AddBcc "bcc_person@hotmail.com"
   ' Subject of Email
   objMail.Subject = "your_subject"
   objMail.Body = "You body"
   ' True means HTML send
   objMail.IsHTML = True
   ' Attach files if it is checked
   objMail.AddAttachment "C:\windows\desktop\your_file1.exe"
   objMail.AddAttachment "C:\windows\desktop\your_file2.exe"
       
   ' send email
   objMail.Send
   ' errors occured
   If Err <> 0 Then
       Response.Write "Status: Mail Not Sent"
   ' no errors occured
   Else
       Response.Write "Status: Mail Sent Successfully"
   End If

   Set objMail = Nothing
%>

For more information of the coding. Download user manual from http://www.aspemail.com/Manual.htm

hongjun
0
 
LVL 33

Expert Comment

by:hongjun
Comment Utility
Sorry please replace my third line of the above AspEmail code with this

Set objMail = Server.CreateObject("Persits.MailSender")

hongjun
0
 
LVL 33

Expert Comment

by:hongjun
Comment Utility
If you are not using Asp, then go to http://www.hotscripts.com

There's a lot of other examples using PHP, Python, etc.

hongjun
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 9

Author Comment

by:Bob Stone
Comment Utility
I am on my ISP server, and I know squat about ASP. I did however find a cgi that will do that, sort of. I will post another Q soon re that.
0
 
LVL 9

Author Comment

by:Bob Stone
Comment Utility
  I am going to delete this Q, I think I may have found a more feasable(sp?) way to do this. I will post another Q soon, if needed.
0
 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
Hi stone5150,
You've requested to delete this question, but its status has remained as 'Pending Delete' because one or more comments have been added.  Normally, the only way to fully delete such a Question is to post a message to Community Support and ask for assistance.

EE is making a one-time database sweep to purge the Pending Delete Questions automatically.  During this sweep:

    stone5150 -- To allow the deletion to proceed:  Do nothing.
    EXPERTS -- Please DON'T POST a comment except to contest this deletion.

In the future, please refer to http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp#8 for instruction on deleting questions.

DanRollins -- EE database cleanup volunteer
0
 
LVL 15

Expert Comment

by:a.marsh
Comment Utility
mmm....not sure....I think we provided some useful info here...

Ant
0
 
LVL 1

Expert Comment

by:Moondancer
Comment Utility
Listening for responses here.
Moondancer - EE Moderator
0
 
LVL 9

Author Comment

by:Bob Stone
Comment Utility
They wouuld have been useful if I had a clue about ASP, which I don't I have since written some CGIs to handle it. Check my profile for these Q which were answered and points given.
0
 
LVL 1

Accepted Solution

by:
Moondancer earned 0 total points
Comment Utility
200 points refunded, item moved to PAQ at zero and closed.

It would help tremendously, Stone, for you to post cross-reference link on such issues and ask us to help you when comments have been added and subsequent deletions requested (for future items).

Moondancer - EE Moderator
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now