Training, Open Source
computer languages


PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 

Search our site for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Windows Mailer

Posted by TedH (TedH), 4 November 2005
Hi guys, on Unix/Apache web servers we have SendMail. Fair enuf, easy to set up a mail notification.

However Windows servers use something different and I haven't got a clue as to what it is or how to find out info on it ( I know nothing about Windows servers).

So I've come here
My continuing blog project has reached the point of mail notification of a comments posting. I've got the Unix Sendmail one working...

Code:
open (SENDMAIL, "|/usr/lib/sendmail -t") or die "cannot open sendmail: $!";
print SENDMAIL "To: me\@mine.net\n";   # Email to receiver
print SENDMAIL "From: you\@yours.com\n";        # Your email (backslash required)
print SENDMAIL "Reply to: you\@yours.com\n";    # Your email (backslash required)
print SENDMAIL "Subject: Comment Added to blog\n\n";   # Subject title
print SENDMAIL "A new comment has been added to the entry, ( $title ) on the blog"; # message
close(SENDMAIL);


...and need to offer an option for the main Windows alternative.

What do I do? Or where can I find out?

Hope you can help - cheers - Ted

Posted by Custard (Custard), 4 November 2005
Hi,

Have you checked out CPAN?

I use Mail::Sendmail in some of my programs. Despite it's name, it is platform independant according to its pod.

You may have to edit its Sendmail.pm and change the name of the smtp mail server to one of yours if it's not on 'localhost'.

Example:
Code:
       require Test::More;
       Test::More->import( tests => 4 );
       my $mailer = new BT::SAN::Mailer( 'custard@cpan.org' );
       ok( defined $mailer,                    'instantiated...' );
       ok( $mailer->subject( 'Testing 123' ),  'added subject...');
       ok( $mailer->body( 'Is this microphone working?...' ),  'added body...');
       ok( $mailer->send(),                    'send()...' );


There are other Mail:: modules on CPAN too.

HTH

Bruce

Posted by TedH (TedH), 4 November 2005
Hi Custard, the blog is going to end up as a give away on a freebie scripts site, so anything I have as an option will have to be some sort of generic Windows thingy. Otherwise I can just have a bit in the instructions saying that they'll have to sort out the mailer themselves and replace the Nix Sendmail bit of code.

I just wasn't sure, as most Unix Apache servers use Sendmail and I have this feeling that there could be just about anything on Windows ones  

- Ted

Posted by TedH (TedH), 5 November 2005
Custard, thanks, I looked around (CPAN etc) and there seems to be quite a variety of mail packages used on Windows servers. So, I've set up the script with options (0=none, 1=Unix/Sendmail, 2=Windows) and will do a blurb in the instructions about the user sorting it out with their sys admin as I would not know which one anybody's using.

I found several different mail systems (some very expensive) and references to more and figured, 'that's enough, I'm gonna be here all week'.

cheers - Ted



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.


WELL HOUSE CONSULTANTS LTD.: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho