Solved

Sending mail from cgi

Posted on 1997-12-08
7
178 Views
Last Modified: 2013-12-25
How do I send a mail from a (ANSI C) cgi program? I don't want the user to interfere. The mail should be entirely automatic. Maybe I have to do this through a JavaScript?
0
Comment
Question by:obg
7 Comments
 
LVL 7

Expert Comment

by:faster
ID: 1831580
A CGI right?  You need only download a perl script to do that.  "Formmail" or something else will do.


0
 
LVL 2

Author Comment

by:obg
ID: 1831581
Sorry! I have to use ANSI C. If that can't be done, I have to use some JavaScript, or such.
0
 
LVL 7

Expert Comment

by:faster
ID: 1831582
what platform?
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 2

Author Comment

by:obg
ID: 1831583
I use a unix platform, but I would like the solution to be as portable as possible. I realize that I can use the system("mail") function, but who will be the sender? - Guess I'll have to try...
0
 

Accepted Solution

by:
mikal120797 earned 100 total points
ID: 1831584
Ok. This works on Linux, I assume it is standard. If this sample below doesn't work play with it -- it should work fine. Oh, and to use rmail you need to be running sendmail.

Call system("rmail recipient < filename_to_be_sent");

The first line of the file to be sent should read:
From user_who_sent_it

NOTE: No colon...
0
 

Expert Comment

by:kennethm
ID: 1831585
if you use "mail recipient < filename_to_be_sent", the sender will be the http daemon of your web server.

You can also use "mailx -r recipient -s subject < filename_to_be_sent"

"Sendmail" also performs simliar options.
0
 
LVL 2

Author Comment

by:obg
ID: 1831586
I know the sender will be the http deamon, but I can change the sender, as mikal said, using From... I can still see, however, that the mail comes from the deamon. What is the difference in this aspect between rmail and mailx?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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 …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
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…
The viewer will learn how to dynamically set the form action using jQuery.

757 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

20 Experts available now in Live!

Get 1:1 Help Now