Amazon-SendToKindle

 view release on metacpan or  search on metacpan

lib/Amazon/SendToKindle.pm  view on Meta::CPAN


# Constructor.
sub new {
	my ($class) = @_;
	my $self = {
		file_name => $_[1],
		address => $_[2],
		smtp_server => $_[3],
		smtp_port => $_[4],
		smtp_user => $_[5],
		smtp_password => $_[6]
	};

	bless $self, $class;
	return $self;
}

# Sends the document.
sub send {
	my ($self, $account, $convert) = @_;
	$account = "$account\@kindle.com";

	# Setup Net::SMTP.
	my $email = new Net::SMTP::TLS(
		$self->{smtp_server},
		Port => $self->{smtp_port},
		User => $self->{smtp_user},
		Password => $self->{smtp_password},
		Timeout => 60);
	$email->mail($self->{address});
	$email->to($account);
	$email->data();

	# Prepare the email subject.
	my $subject = "";
	if ($convert) {
		$subject = "convert";
	}

lib/Amazon/SendToKindle.pm  view on Meta::CPAN


=head1 SYNOPSIS

  use Amazon::SendToKindle;
  my $kindle = Whisper::SendToKindle->new(
      "document.pdf",
      "your@email.com",
      "smtp.server.com",
      $port,
      "username",
      "password);
  $kindle->send("amazon_username", 0);  # Do not include the @kindle.com

=head1 DESCRIPTION

This is my first module for the Perl community. It was created to be used in one of my projects called Whisper: https://github.com/nathanpc/whisper

It's a extremely easy and straight forward way to send documents to Amazon's Kindle Personal Documents Service (aka "Send to Kindle").

=head1 SEE ALSO



( run in 1.275 second using v1.01-cache-2.11-cpan-49f99fa48dc )