Solved

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

Posted on 2004-09-02
7
881 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Add code to body in wordpress site 8 45
site launch date and last modified date 3 80
Element alignment and word wrapping 9 61
get multiple images to align right 5 44
Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
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…
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.

920 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

16 Experts available now in Live!

Get 1:1 Help Now