Advertisement
Guest User

GarciaPL

a guest
Feb 17th, 2015
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.89 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2. use strict;
  3. use POSIX;
  4. use WebService::Mandrill;
  5. use Finance::Currency::Convert::Yahoo;
  6.  
  7. $Finance::Currency::Convert::Yahoo::CHAT = 1;
  8. $_ = Finance::Currency::Convert::Yahoo::convert(9430,'HUF','PLN');
  9.  
  10. if (defined($_)) {
  11.    if (floor($_) gt 135) {
  12.       print "Sell HUF : ".floor($_)."\n";
  13.       send_email('receiver@gmail.com', 'Sell HUF', 'Right now there is the time to sell HUF');
  14.    } else {
  15.       print "Keep HUF\n";
  16.    }
  17. } else {
  18.    print "Error\n";  
  19. }
  20.  
  21. sub send_email {
  22.  
  23.     (my $to, my $subject, my $body) = @_;
  24.  
  25.     my $mandrill = WebService::Mandrill->new(
  26.             debug   => 1,
  27.             api_key => 'YOUR_API_TO_MANDRILL',
  28.         );
  29.  
  30.     my $response = $mandrill->send(
  31.         subject      => $subject,
  32.         from_email   => "sender\@gmail.com",
  33.         text         => $body,
  34.         track_opens  => 1,
  35.         track_clicks => 1,
  36.         to => [
  37.             { email => $to }
  38.         ],
  39.     );
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement