• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1353
  • Last Modified:

Attach image file to mailto form

  How do I get a mailto form open a box or whatever to allow image to be attached to emailed form before sending?
0
Bob Stone
Asked:
Bob Stone
  • 5
  • 3
  • 3
  • +2
1 Solution
 
a.marshCommented:
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
 
a.marshCommented:
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
 
hongjunCommented:
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
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
hongjunCommented:
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
 
hongjunCommented:
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
 
hongjunCommented:
Sorry please replace my third line of the above AspEmail code with this

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

hongjun
0
 
hongjunCommented:
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
 
Bob StoneIT GuruAuthor Commented:
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
 
Bob StoneIT GuruAuthor Commented:
  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
 
DanRollinsCommented:
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
 
a.marshCommented:
mmm....not sure....I think we provided some useful info here...

Ant
0
 
MoondancerCommented:
Listening for responses here.
Moondancer - EE Moderator
0
 
Bob StoneIT GuruAuthor Commented:
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
 
MoondancerCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
  • 3
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now