The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mail::Client::Yahoo - Programmatically access Yahoo's web-based email

SYNOPSIS

  use Mail::Client::Yahoo;

  $y = Mail::Client::Yahoo->login(
    username => 'bob',
    password => 'secret',
    secure   => 1,            # for the paranoid and patient
  );

  $y->select_folder('Inbox');

  $m = $y->message(0);        # is equivalent to...
  @ids = $y->message_list();
  $y->message($id[0]);

  $y->delete_message(0);

  $y->logout();

DESCRIPTION

This module allows you to access your web-based Yahoo Mail account programatically. Similar in function to Mail::Webmail::Yahoo, this module is more geared towards manipulation of individual messages, rather than simple bulk download. This module is also probably more reliable than Mail::Webmail::Yahoo, as well.

METHODS

login( %options )

Creates a new Mail::Client::Yahoo object, and logs in to the Yahoo Mail server. You must include the username and password options. (The username and password is sent over a secure HTTPS connection.)

You may also include an error option, which should be a reference to a subroutine to be called if there is an error. The default handler simply dies.

You may also include a secure option, which should be either 0 or 1. If secure is 1, the session uses a secure HTTPS connection, instead of a standard HTTP connection (the default). Note that the secure connection will be slower, and the username and password are always sent over HTTPS, regardless of the value of secure.

logout( )

Log out, and disconnect from the server.

folder_list( )

Returns a list of the names of all available folders.

select_folder( $name )

Selects the current working folder. This must be done before any of the message methods may be used.

folder_size( $name )

Returns the size of a folder, as give by Yahoo. This size will usually be a string ending in `K', which gives the number of kilobytes in the message. This is not an exact size.

folder_count( $name )

Returns the number of messages in a folder.

message_list( )

Returns an array containing the message-id's of all the messages in the current folder.

message_size( $msgid_or_index )

Returns the size of the message, as given in the folder listing. As with the folder size, it is not exact, and will most likely be a number followed by a `K' or `M', indicating kilobytes and megabytes, respectively.

Note: The parameter passed may either be a message-id, such as returned from the "message_list( )" function, or the index of a message in that list.

message_head( $msgid_or_index )

Returns a Mail::Header object containing the headers of the message.

message_body( $msgid_or_index )

Returns a Mail::Internet object containing the body of the message. Note that the returned object contains only the body of the message; the headers are left empty.

This is the complete (possibly MIME-encoded) message body, including any attachments.

message( $msgid_or_index )

Returns a Mail::Internet object containing both the headers and body of the message.

This is the complete message, including any attachments.

move_message( $msgid_or_index, $folder_name )

Moves a message from the current folder to another folder.

delete_message( $msgid_or_index )

Moves a message from the current folder to the special Trash folder. Note that the Trash folder is not emptied automatically (though it may be purged by Yahoo at random times).

send_message( %options )

Sends a message via the Yahoo website. You must specify a primary recipient via to, a subject, and a body. You may also specify additional recipients via cc and bcc, a boolean indicating whether to save the message in your Sent folder via save, and a boolean indicating whether the body contains HTML formatting via html.

Additionally, you can specify an array reference via attach containing a list of up to three file names to upload as attachments.

empty_trash( )

Removes all messages from the Trash folder. These messages are permanently lost.

SEE ALSO

Mail::Header, Mail::Internet, WWW::Mechanize, HTML::TableExtract

AUTHOR

Copyright (C) 2004, Cory Johns.

This module is free software; you can redistribute and/or modify it under the same terms as Perl itself.

Address bug reports and comments to: Cory Johns <johnsca@cpan.org>