Solved

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

Posted on 2004-09-02
7
887 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
[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
  • 3
  • 3
7 Comments
 

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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
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…

695 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