In a nice little linq one liner with a lambda I handle the null case and aggregate all the paths with root:
public string CombinePaths(string root, params string[] args)
{
return Path.GetFullPath(args.Aggregate(root, (current, path) => Path.Combine(current ?? string.Empty, path ?? string.Empty)));
}
Point Carré
Tuesday, February 5, 2013
Wednesday, October 17, 2012
Getting Net-SMTP-SSL-1.01 installed on Windows.
I'm using at my company which we have recently reconfigured to use our corporate mail which is now a Google service.The Activestate installation for Windows that I have installed does not have the Net-SMTP-SSL package available. Here's how you can get installed and running.
1) Install the openssl package from GNU.
2) Next I downloaded the package from CPAN.org (use their download link). Expand the archive into a working folder of your choice, then from a command prompt run the next steps.
3) If you don't have this package installed, use the package manager to get gcc on your machine:
- ppm install MingGW
5) dmake
6) dmake install
At this point you could go find a sample script on the web to test the setup with google, here's what I found and used:
#############################################
#
#!/uMIME::Base64 and Authen::SASLsr/bin/perl
# smtp-ssl with auth
use warnings;
use strict;
use Net::SMTP::SSL;
my $user = 'username';
my $pass = 'password';
my $server = 'smtp.gmail.com';
my $to = 'username';
my $from_name = 'from name';
my $from_email = 'from email';
my $subject = 'smtp-ssl-auth test';
my $smtps = Net::SMTP::SSL->new($server,
Port => 465,
DEBUG => 1,
) or die "$!\n";
# I just lucked out and this worked for auth (yeah inheritance :-) )
defined ($smtps->auth($user, $pass))
or die "Can't authenticate: $!\n";
$smtps->mail($from_email);
$smtps->to($to);
$smtps->data();
$smtps->datasend("To: $to\n");
$smtps->datasend(qq^From: "$from_name" <$from_email>\n^);
$smtps->datasend("Subject: $subject\n\n");
$smtps->datasend("This will be the body of the message.\n");
$smtps->datasend("\n--\nVery Official Looking .sig here\n");
$smtps->dataend();
$smtps->quit();
print "done\n";
#You can alternatively just put everything in the
#argument to $smtps->data(),
#and forget about datasend() and dataend();
__END__
Subscribe to:
Posts (Atom)