Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Send File from Webpage as MIME attatchment

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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
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.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

650 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