~ubuntu-branches/ubuntu/intrepid/horae/intrepid

« back to all changes in this revision

Viewing changes to 0CPAN/Spreadsheet-WriteExcel-2.15/examples/sendmail.pl

  • Committer: Bazaar Package Importer
  • Author(s): Carlo Segre
  • Date: 2008-02-23 23:13:02 UTC
  • mfrom: (2.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080223231302-mnyyxs3icvrus4ke
Tags: 066-3
Apply patch to athena_parts/misc.pl for compatibility with 
perl-tk 804.28.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl -w
2
 
 
3
 
###############################################################################
4
 
#
5
 
# Example of how to use Mail::Sender to send a Spreadsheet::WriteExcel Excel
6
 
# file as an attachment.
7
 
#
8
 
# See the Mail::Sender module for further details.
9
 
#
10
 
# reverse('�'), August 2002, John McNamara, jmcnamara@cpan.org
11
 
#
12
 
 
13
 
 
14
 
use strict;
15
 
use Spreadsheet::WriteExcel;
16
 
use Mail::Sender;
17
 
 
18
 
# Create an Excel file
19
 
my $workbook  = Spreadsheet::WriteExcel->new("sendmail.xls");
20
 
my $worksheet = $workbook->add_worksheet;
21
 
 
22
 
$worksheet->write('A1', "Hello World!");
23
 
 
24
 
$workbook->close(); # Must close before sending
25
 
 
26
 
 
27
 
 
28
 
# Send the file.  Change all variables to suit
29
 
my $sender = new Mail::Sender
30
 
{
31
 
    smtp => '123.123.123.123',
32
 
    from => 'Someone'
33
 
};
34
 
 
35
 
$sender->MailFile(
36
 
{
37
 
    to      => 'another@mail.com',
38
 
    subject => 'Excel file',
39
 
    msg     => "Here is the data.\n",
40
 
    file    => 'mail.xls',
41
 
});
42
 
 
43