Solved

Send File from Webpage as MIME attatchment

Posted on 1997-02-24
3
255 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
  • 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

747 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

12 Experts available now in Live!

Get 1:1 Help Now