Hi Monks, And for my next question! I'm trying to use Mail::SendMail to send mail on a windows server that I only have basic ftp access to, so can't install anything on it only put things on locally. The hosts recommend that I use this one. After much reading I found out how to 'use' it correctly (I think!) but it now doesn't know what I mean when I call 'new'. Here's my code:-
#!/usr/bin/perl use CGI; use warnings; use strict; use lib "Mail::SendEasy"; use CGI::Carp qw/fatalsToBrowser/; my $query = new CGI; print $query->header(); print "\@INC is @INC\n<br>"; my $mail = new Mail::SendEasy( smtp => 'localhost' , user => 'foo' , pass => 123 , ) ; my $status = $mail->send( from => 'sender@foo.com' , from_title => 'Foo Name' , reply => 're@foo.com' , error => 'sarah@sarahsfleeces.co.uk' , to => 'sarah@sarahsfleeces.co.uk' , #cc => 'recpcopy@domain.foo' , subject => "MAIL Test" , msg => "The Plain Msg..." , html => "<b>The HTML Msg...</b>" , msgid => "0101" , ) ; if (!$status) { print $mail->error ;} print "it works!";
The error message is:-
Can't locate object method "new" via package "Mail::SendEasy" (perhaps + you forgot to load "Mail::SendEasy"?) at d:\domains\mysite.co.uk\www +root\cgi-bin\Send_Details.pl line 35.
I'm sure this is just a simple syntax error on my part, maybe to do with how I've 'use'd the module SendEasy but after hours of reading on the net and on here that's the only way I've found for it to not cause an error on that line... any suggestions gratefully received if that's the wrong way to do it. I appreciate I could load it on locally as another option but I don't like giving up that easily! Many thanks Sarah

In reply to Why won't call to SendEasy 'send' sub won't work? by Stoney

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.