Solved

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

Posted on 2004-09-02
7
885 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
 
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
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime is disastrous for companies and can lead to major hits on a brand, reputation, an…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

730 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