Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- use strict;
- use POSIX;
- use WebService::Mandrill;
- use Finance::Currency::Convert::Yahoo;
- $Finance::Currency::Convert::Yahoo::CHAT = 1;
- $_ = Finance::Currency::Convert::Yahoo::convert(9430,'HUF','PLN');
- if (defined($_)) {
- if (floor($_) gt 135) {
- print "Sell HUF : ".floor($_)."\n";
- send_email('receiver@gmail.com', 'Sell HUF', 'Right now there is the time to sell HUF');
- } else {
- print "Keep HUF\n";
- }
- } else {
- print "Error\n";
- }
- sub send_email {
- (my $to, my $subject, my $body) = @_;
- my $mandrill = WebService::Mandrill->new(
- debug => 1,
- api_key => 'YOUR_API_TO_MANDRILL',
- );
- my $response = $mandrill->send(
- subject => $subject,
- from_email => "sender\@gmail.com",
- text => $body,
- track_opens => 1,
- track_clicks => 1,
- to => [
- { email => $to }
- ],
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement