I have recently installed the Everything Engine on my system and am running into problems that the user password is never being sent out.
My question isn't about what is happening here, but rather, with my attempt to debug and track down the error. While I would like to know what is going with the mailer, I think it is better to understand why my debugging efforts are screeching to a halt.
The code in question is here:
...
36: use Everything::MAIL;
37: my $addr = node2mail($$haverow{email},$n);
38: $n = getNodeById(getId($n), 'force');
39: $str.="<BR><H3>Your password and username should be on its way;<
+/H3>";
40: $str.= "Addr7: " . $addr;
...
Wihch displays the following output:
Your password and username should be on its way
Addr7: Mail::Sender=HASH(0x8dadfc0)
I thought I understood perl, but I am always humbled when I run across another facet that I don't understand. Why is Mail::Sender=HASH being displayed instead of "1...". I feel as if this should be easy for me to understand, but i've been debugging all day and my brain is frazzled.
The code for node2mail is below. The purpose of doing this was to return address, username, etc. from node2mail and display it on the site to help me identify if the wrong values are being passed and further track down the error.
sub node2mail
{
my ($addr, $node) = @_;
my @addresses = (ref $addr eq "ARRAY") ? @$addr:($addr);
my $user = getNode($$node{author_user});
my $subject = $$node{title};
my $body = $$node{doctext};
use Mail::Sender;
my $SETTING = getNode('mail settings', 'setting');
my ($mailserver, $from);
if ($SETTING) {
my $MAILSTUFF = $SETTING->getVars();
$mailserver = $$MAILSTUFF{mailServer};
$from = $$MAILSTUFF{systemMailFrom};
} else {
$mailserver = "localhost";
$from = "root\@localhost";
}
my $sender = new Mail::Sender{smtp => $mailserver, from => $fr
+om};
$sender->MailMsg({to=>$addr,
subject=>$subject,
msg => $body});
$sender->Close();
my $value = "1...";
return $value;
}
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.