?
Solved

Send File from Webpage as MIME attatchment

Posted on 1997-02-24
3
Medium Priority
?
268 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 210 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

TCP/IP Network Protocol Cheat Sheet

TCP/IP is a set of network protocols which is best known for connecting the machines that make up the Internet. The truth is that TCP/IP is one of the oldest network protocols and its survival is mainly based on its simplicity and universality.

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 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…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
Suggested Courses

770 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