Solved

Send File from Webpage as MIME attatchment

Posted on 1997-02-24
3
266 Views
Last Modified: 2013-12-25
I need a script that sends a user defined file in a mail, as a attatchment, from a form on a webpage an adress free of
choice.

For an exempel:

             Welcome to "virtual postcard"

             Your E-mail:
             Recivers E-mail:
             choose one off the pictures:
             Picture1 Picture2 Picture3
               ( ) ( ) ( )
             [Submit]

Now an E-mail should be sent to "reciver" whith
an text (same for all pictures), and the choosen
picture.
IT is Important that the attatchment is in the MIME format..
             
Technical Things

* I'm using an linux server
* I'm able to run my own scripts
/Jonas
0
Comment
Question by:nifer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:nifer
ID: 1827629
Adjusted points to 70
0
 
LVL 1

Accepted Solution

by:
Kallisti earned 70 total points
ID: 1827630
Uhh, got the other one put through as a good answer,
despite it not being 100%..  Feel free to reject/delete
on this one, but I have altered the script so that it
creates a mime-email...

A quick point about it is that it is possible that your
uuencode program does not support base64.  This is
required for MIME, however, if it does not, altering
the base64 line to uuencoded, and remove the -m arg
from uuencode.

#!/bin/sh
#
# No (c), no warantee, no payment required, NOT MY FAULT.
# Bugs: I have not bothered to check ANYTHING bar the sendmail
# This will mail to any address, etc.. needs to be more paranoid.

SENDMAIL="/usr/sbin/sendmail"
# Ensure that is correct!

EMAILADDR=`echo $QUERY_STRING | cut -d\& -f1 | cut -d\= -f2`
PICTURE=`echo $QUERY_STRING | cut -d\& -f2 | cut -d\= -f2`

echo "Content-type: text/html"
echo
echo "<HTML><TITLE>On it's way</TITLE>"
echo "<H1>Its been mailed!</H1>"
echo "Mailed $PICTURE to $EMAILADDR"
echo "</HTML>"

$SENDMAIL $EMAILADDR << EOF
Reply-To: webmaster\@$HTTP_HOST
From: picserver\@$HTTP_HOST
To: $EMAILADDR
MIME-Version: 1.0
Subject: Requested Picture
Content-Type: multipart/mixed;
              boundary=unique-boundary-1

This is the preamble area of a multipart message.
Mail readers that understand multipart format
should ignore this preamble.

If you are reading this text, you might want to
consider changing to a mail reader that understands
how to properly display multipart messages.

--unique-boundary-1

This is the text that describes what the mail
is about to the person who recieved it.

--unique-boundary-1
Content-Type: image/gif
Content-Transfer-Encoding: base64

`uuencode -m $PICTURE $PICTURE`

--unique-boundary-1--
EOF

0
 

Author Comment

by:nifer
ID: 1827631
Sorry only Mime is accepteble
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
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)

696 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