Solved

Requesting CGI script with just the mail command, for IIS, using SMTP mail

Posted on 2004-09-02
7
883 Views
Last Modified: 2008-01-09
May I please have an example of CGI/Perl code that sends mail on IIS?  Assume constants for the email address, subject, etc.  This is for an IIS environment, using SMTP mail.
0
Comment
Question by:thievesguild
  • 3
  • 3
7 Comments
 
LVL 7

Expert Comment

by:suramsureshbabu
ID: 11970330
0
 

Author Comment

by:thievesguild
ID: 11974227
Thank you suramsureshbabu.  Unfortunately most of those examples are for Unix, I believe.  I'm looking for an IIS example.
0
 
LVL 4

Expert Comment

by:rduke15
ID: 11979555
The Perl module Mail::Sendmail (http://alma.ch/perl/mail.html) is not Unix-specific. All it needs is Perl and an SMTP server. Works flawlessly on MS IIS if you have Perl installed.
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:thievesguild
ID: 12045011
Thank you for your reply, rduke.  I'm learning that the directory structure lines in Sendmail do not necessarily indicate that they are specific to Unix-Linux.  

However, I was hoping to get simple CGI commands.  Does CGI have the equivalent for the ASP following?

ASP
Set NewMailObj=Server.CreateObject("CDONTS.NewMail")
NewMailObj.From = "from@address.com"
NewMailObj.To = "to@address.com"
NewMailObj.Subject = "email subject"
NewMailObj.Body = "email body"
NewMailObj.Send

0
 
LVL 4

Expert Comment

by:rduke15
ID: 12048231
With CGI, you call some program on the server, which prints out HTML, and the web server sends that HTML to the client browser. The program itself can be anything the server is able to run: some compiled executable, or any script for the language of which the server has an interpreter.

With ASP (like with PHP and others), you call some HTML file which has embedded programming commands. The server reads the file, sends the plain HTML bits directly back to the browser, sends the scripted bits to the interpreter which gives some HTML back, which is then sent to the client browser. ASP is mostly used with VBscript on Microsoft IIS servers, even though it can also be used with Perl, and I understand there are ASP or ASP-like implementations on Unix.

So if you want some VBscript under ASP and Microsoft IIS, that's not CGI, and your best bet would seem to be to ask in a dedicated Microsoft/ASP forum.

If you want to try out CGI, try it at the commmand line first; once it works there and does what you want, it should be easy to have the web server run it.

About the Mail::Sendmail module, it requires you to write a Perl script to use it,  so you have to know (at least some) Perl.

As for the others, that were suggested by suramsureshbabu, they all seem to be relying on the Unix sendmail executable to do the actual mailing, so that wouldn't be portable. Besides, at first glance, they all seem ancient and insecure.

Good luck.
0
 

Author Comment

by:thievesguild
ID: 12048986
Thank you for your reply, rduke15.  I suspect I'm using the wrong terms.  I do understand that I need to write Perl with CGI.  Everyone seems to imply there is a way to simply send mail on a web server that has SMTP configured, but I can never get a simple code example that doesn't require a module.

Is this a waste of time?
0
 
LVL 4

Accepted Solution

by:
rduke15 earned 350 total points
ID: 12049241
It IS simple if you know some Perl (if you don't, it's fun to learn anyway; try "Programming Perl").

And yes, most scripts these days rely on various modules for common tasks (why re-invent the wheel?). Personally, I use sendform.cgi (http://alma.ch/perl/scripts.html), but there are tons of other similar scripts.

If you are trying to do CGI scripting in Perl without any Perl module, then yes, that definitely would be a waste of time. :-)

BTW, have you already typed things like "perldoc Some::Module", "perldoc -f  somefunction", perldoc somescript.pl", etc. at the command line? If you haven't, start with "perldoc perldoc" and "perldoc perl".

0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from 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

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Read about why website design really matters in today's demanding market.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmakerā€¦
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.

816 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