Re: [ProgSoc] How to send emails in cgi scripts

daedalus (jpw001@nospam.its.maynick.com.au)
Mon, 29 Dec 1997 09:30:44 +1030 (CST)


On Sat, 27 Dec 1997, Trinh Quang Nguyen wrote:

> Hi,
>
> Can anyone tell me how to write a cgi script to send emails.
> I've seen examples using "sendmail" but it doesn't seem to work. Is
> "sendmail" available or is there another program that I should be using?

It really depends on what you're attempting to do. You can send mail from
netscape from a page by adding a mailto: tag in your html:

<a href="mailto:someone@nospam.somewhere.com">Mail me!</a>

Otherwise you'd be passing variables to a script which then parses them
and sends them on to a mail program (like sendmail or mail). From command
line you can send email using something like:

#!/bin/sh
echo "Stuff I want to send" > mailfile
echo "to someone" >> mailfile
echo "from a file" >> mailfile

cat mailfile | mail someone@nospam.somewhere.com

Read the manual page for flags for the subject line etc

man mail

or you could use sendmail. I can't remember the flags offhand. I'd just
be checking the manual page anyway.

man sendmail

sendmail is available on most unix boxes, and is available on ftoomsh as
far as I know.

+---------------------------+-----------------------------------------+
| Justin Warren | justin.warren@nospam.its.maynick.com.au |
| Systems Administrator | daedalus@nospam.progsoc.uts.edu.au |
| Mayne Nickless Express IT | http://www.progsoc.uts.edu.au/~daedalus |
+---------------------------+-----------------------------------------+
| Just because you're paranoid doesn't mean they're NOT after you... |
+---------------------------------------------------------------------+

--
You are subscribed to the progsoc mailing list. To unsubscribe, send a
message containing "unsubscribe" to progsoc-request@nospam.progsoc.uts.edu.au.
If you are having trouble, ask owner-progsoc@nospam.progsoc.uts.edu.au for help.

This list is archived at <http://www.progsoc.uts.edu.au/lists/progsoc/>