To add in excel a body and a subject in the mail link, append the mail address with an attribute part like this in Excel:

=(Hyperlink("Mailto:me@home.com?Subject=Emailing From Excel&Body=This +is a test"))

Some fragments that could be handy if you want to send the mail directly with perl.

If you want to read excel file to obtain the emails given inside.

use Spreadsheet::Read; #use only for simply excel files # take the filename from commandline and try to take in the excel file my $file1 = ReadData ($excelfile); # obtain the last line on the first sheet my $max_row1 = $file1->[1]{maxrow}; # loop through the rows for (my $i; $i <= $max_row1; $i++) { # read the name on the cell A $i my $name = $file1->[1]{cr2cell ( 1, $i)}; # read the file on the cell B $i my $file = $file1->[1]{cr2cell ( 2, $i)}; }

To compose an email with perl.

use MIME::Lite; my $from_address = 'me@home.com'; my $out_server = 'out.home.com'; my $subject = "subject"; my $body = <<"MAIL"; blabla MAIL my $document = 'some data' #open and put data into this my $filename = 'see above' ### Create a new multipart message: my $msg = MIME::Lite->new( From => $from_address, To => $email_address, Subject => $subject, Type => 'multipart/mixed' ); ### Add parts (each "attach" has same arguments as "new"): $msg->attach( Type => 'TEXT', Data => $body ); $msg->attach( Type => $mime_type, Data => $document, Filename => $file, Disposition => 'attachment' ); ### use Net:SMTP to do the sending. Depends on your system what to use +. eval {$msg->send('smtp', $out_server);}; # via a outbound mailserver eval {$msg->send();}; # sending via local send command on linux system

have a nice day

Martell


In reply to Re: Sending email from excel by one click by martell
in thread Sending email from excel by one click by pavan6754

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.