Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Command line usage error

Quote Reply
Command line usage error
I am having problems sending email from a plugin.
This was working from my plugin yesterday, so I am not sure how I broke it.

Lines 241-244
Code:
# Mail the email.
if ($opts->{gb_email_add}) {
Links::send_email('gb_added.eml', { %{$USER || {}}, %$input, %$rec } ) or die "Unable to send mail: $GT::Mail::error";
}

I get the following error:
Quote:
Unable to send mail: Unable to send email: Command line usage error at guestbook.cgi line 242.
For help, please send mail to the webmaster giving this error message and the time and date of the error.

Content-type: text/html

A fatal error has occured:
[Sat Apr 9 14:32:39 2005] guestbook.cgi: Unable to send mail: Unable to send email: Command line usage error at guestbook.cgi line 242.

Please enable debugging in setup for more details.

It says the error is line 242 which is: if ($opts->{gb_email_add}) {

Also, if you look closely, error also redundently says "Unable to send mail: Unable to send email:"


OK, I JUST figured out that emails send properly when I am logged-in as a user, but not when I am *NOT* logged-in

That's as far as I am. Please help.

Note: I am sending emails to the Link-Owner, Not a User or Admin

Thanks again,
Chris
RGB World, Inc. - Software & Web Development.
rgbworld.com
Quote Reply
Re: [rgbworld] Command line usage error In reply to
Enable debugging and pm me the output.

Adrian
Quote Reply
Re: [brewt] Command line usage error In reply to
OK, I got it. Thanks Adrian.

I added 1 line of code before 'optionally' calling Links::sendmail.
I also deleted $USER from the tag argument in the call to sendmail per your suggestion.

Code:
# This was the fix
$input->{Email} = $rec->{Contact_Email};

# Mail the email.
if ($opts->{gb_email_add}) {
Links::send_email('gb_added.eml', { %$input, %$rec } ) or die "Unable to send mail: $GT::Mail::error";
}

So, this is what was happening...
When logged in, <%Email%> was being taken from $USER when parsing the .eml file

When not logged-in, $USER was empty, so <%Email%> was not defined either.
Seems I have the link record (which contains "Contact_Email"), I simply put the email
into the $input tag so that it would get swapped out when parsing gb_added.eml.

Am I starting to understand all this stuff yet? Smile

Chris
RGB World, Inc. - Software &amp; Web Development.
rgbworld.com