Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > How to access mail program on Windows server

Reply
Thread Tools

How to access mail program on Windows server

 
 
Monty
Guest
Posts: n/a
 
      01-07-2004

I'm a novice programmer and have used this line of code to access the
mail program on my provider's server and it has worked fine:


$mailprog = '/usr/lib/sendmail -i -t';

# Open The Mail Program
open(MAIL,"|$mailprog");

print MAIL "To: ((E-Mail Removed))";
print MAIL "From: Me";
etc etc

I'm now writing a script which will reside on a Windows server and will
need to send the contents of a form to an email address. How do I tell
the Perl in my CGI script where the Windows mail server is? It obviously
isn't at /usr/lib/sendmail . How do I code this section differently for
a Windows server than an Unix server?

Monty

 
Reply With Quote
 
 
 
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      01-07-2004
Monty wrote:
> I'm a novice programmer and have used this line of code to access
> the mail program on my provider's server and it has worked fine:
>
> $mailprog = '/usr/lib/sendmail -i -t';
>
> # Open The Mail Program
> open(MAIL,"|$mailprog");
>
> print MAIL "To: ((E-Mail Removed))";
> print MAIL "From: Me";
> etc etc
>
> I'm now writing a script which will reside on a Windows server and
> will need to send the contents of a form to an email address. How
> do I tell the Perl in my CGI script where the Windows mail server
> is? It obviously isn't at /usr/lib/sendmail . How do I code this
> section differently for a Windows server than an Unix server?


If there is a command line MTA, similar to sendmail, installed, you
can just use the applicable path and possible flags. Otherwise (and
more likely) you'll need to make use of one of the many modules for
the purpose. My personal favorite is Mail::Sender, since it 'has it
all'. Often recommended here is MIME::Lite.

Btw, there are many form-to-mail programs available that you might
find useful. What kind of form is it? If it's a simple contact form,
you may want to explore the CPAN module CGI::ContactForm, which is
very easy to use. If you need more flexibility, you may prefer one of
the form-to-mail scripts at http://nms-cgi.sourceforge.net/scripts.shtml

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

 
Reply With Quote
 
 
 
 
A man
Guest
Posts: n/a
 
      01-07-2004
In article <RZNKb.720$(E-Mail Removed)>, johndoe44
@hotmail.com spoke thusly...
>
> I'm a novice programmer and have used this line of code to access the
> mail program on my provider's server and it has worked fine:
>
>
> $mailprog = '/usr/lib/sendmail -i -t';
>
> # Open The Mail Program
> open(MAIL,"|$mailprog");
>
> print MAIL "To: ((E-Mail Removed))";
> print MAIL "From: Me";
> etc etc
>
> I'm now writing a script which will reside on a Windows server and will
> need to send the contents of a form to an email address. How do I tell
> the Perl in my CGI script where the Windows mail server is? It obviously
> isn't at /usr/lib/sendmail . How do I code this section differently for
> a Windows server than an Unix server?


I think it's just:
$mailprog = 'c:\program files\mailer\sendmail -i -t';

Add whatever command line args you need for the subject, to address,
and body. You can use the backslashes too.


--
Say no to fixed width tables. They look terrible in all browsers.
 
Reply With Quote
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      01-07-2004
A man wrote:
> In article <RZNKb.720$(E-Mail Removed)>,
> johndoe44 @hotmail.com spoke thusly...
>> I'm now writing a script which will reside on a Windows server
>> and will need to send the contents of a form to an email address.
>> How do I tell the Perl in my CGI script where the Windows mail
>> server is? It obviously isn't at /usr/lib/sendmail . How do I
>> code this section differently for a Windows server than an Unix
>> server?

>
> I think it's just:
> $mailprog = 'c:\program files\mailer\sendmail -i -t';


Is that a standard program on Windows servers? If not, how can you tell?

> You can use the backslashes too.


Maybe, but what would the point be with that? They are not needed in
Perl programs, but it's easy to make mistakes if you use them.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

 
Reply With Quote
 
pkent
Guest
Posts: n/a
 
      01-07-2004
In article <RZNKb.720$(E-Mail Removed)>,
Monty <(E-Mail Removed)> wrote:

> I'm a novice programmer and have used this line of code to access the
> mail program on my provider's server and it has worked fine:
>
>
> $mailprog = '/usr/lib/sendmail -i -t';
>
> # Open The Mail Program
> open(MAIL,"|$mailprog");
>
> print MAIL "To: ((E-Mail Removed))";
> print MAIL "From: Me";
> etc etc
>
> I'm now writing a script which will reside on a Windows server and will
> need to send the contents of a form to an email address. How do I tell
> the Perl in my CGI script where the Windows mail server is? It obviously
> isn't at /usr/lib/sendmail . How do I code this section differently for
> a Windows server than an Unix server?


If you want to not change your code much, I've heard of a drop-in
sendmail for windows...
http://w.google.com/search?q=sendmail%20for%20windows

There may be others.

OTOH search for Mail on search.cpan.org and there are perl modules to
help you send mail.

P

--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply
 
Reply With Quote
 
Monty
Guest
Posts: n/a
 
      01-08-2004
Sendmail for Windows works. It can be combined with an existing Windows
SMTP server to get the functionality I need. Hardly had to change my
script at all. Thanks so much for all of your help.

Monty


pkent wrote:

> In article <RZNKb.720$(E-Mail Removed)>,
> Monty <(E-Mail Removed)> wrote:
>
>
>>I'm a novice programmer and have used this line of code to access the
>>mail program on my provider's server and it has worked fine:
>>
>>
>>$mailprog = '/usr/lib/sendmail -i -t';
>>
>> # Open The Mail Program
>> open(MAIL,"|$mailprog");
>>
>> print MAIL "To: ((E-Mail Removed))";
>> print MAIL "From: Me";
>>etc etc
>>
>>I'm now writing a script which will reside on a Windows server and will
>>need to send the contents of a form to an email address. How do I tell
>>the Perl in my CGI script where the Windows mail server is? It obviously
>>isn't at /usr/lib/sendmail . How do I code this section differently for
>>a Windows server than an Unix server?

>
>
> If you want to not change your code much, I've heard of a drop-in
> sendmail for windows...
> http://w.google.com/search?q=sendmail%20for%20windows
>
> There may be others.
>
> OTOH search for Mail on search.cpan.org and there are perl modules to
> help you send mail.
>
> P
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
A program is trying to access e-mail addresses you have stored in Outlook Mike P ASP .Net 1 05-25-2007 03:02 PM
!Windows Live Mail replace Outlook Express on Windows XP and Windows Mail on Vista... Max Burke NZ Computing 8 05-18-2007 12:10 AM
ASA5510 dmz mail server forwarding to lan mail server drhopkins@cox.net Cisco 3 04-27-2007 02:42 AM
My mail client reads mail but does not fetch them from server? Leon Java 5 09-29-2005 06:47 PM



Advertisments