From: "Palm Optins" <[EMAIL PROTECTED]>
> The code I'm using is below. I tried changing the   $new_contact =
> $pointer->{"Contact"}; to  $new_subscribe = $pointer->{"Subscribe"};
> and $ito = $new_contact; to $ito = $new_subscribe;
> 
> When I make this change I can't get the mail to go to the subscribed
> address. I've tried everything to get this to mail. Can someone tell
> me what I'm doing wrong?

God knows. Try to print out the parameters you pass to ->Open().

> Here's the way I bought the script. It's written like this.
> 

(I had to reformat it to get anywhere. Please read the included 
comments!)

> $iwhere = "";
> if ($type1 eq "FREE") { $iwhere = " WHERE Type = 'FREE'"; }
> 
> @fields = (Username,Subscribe,Name,Password,Contact,Type,Vacation,
>   Status,Date,Extra1,Extra2,Extra3); 

This should be

@fields = qw(Username Subscribe Name Password Contact Type Vacation
   Status Date Extra1 Extra2 Extra3); 

or

@fields = 
('Username','Subscribe','Name','Password','Contact','Type','Vacation',
  'Status','Date','Extra1','Extra2','Extra3'); 

What you did was dangerous. If you ever defined a function named 
Name() or Type() or any other word mentioned above your script would 
break. You should NOT forget to enclose your string constants in 
quotes.
And you should
        use strict;
on top of your scripts.

> &Db_Connect; 
> 
> $SQL = "SELECT * FROM safelist".$iwhere;
> 
> &Go_SQL; 
> 
> while ($pointer = $sth->fetchrow_hashref) {
>       foreach $field (@fields) {
>               $new_username = $pointer->{"Username"};
>               $new_contact = $pointer->{"Contact"};
>               $new_type = $pointer->{"Type"};
>       }

Why are you looping? Nothing in the loop body depends on the loop 
variable $field !

>       $mline = 
"=====================================================================
=";

It would be better to write:

        $mline = "=" x 70;

>       $msg = "$message\n\n"."$mline\n". "$email_note\n\n". 
"$login_url\n"
>               . "<a   href=\"$login_url\">Click Here to Login</a>\n". "$mline\n";

$msg = <<"*END*";
$message

$mline
$email_note

$login_url
<ahref="$login_url">Click Here to Login</a>
$mline
*END*

>       $ifrom = $name1.  "<".$sub1.">";
>       $ito = $new_contact;
>       $isubject = $subject;
>       
>       use Mail::Sender;

IMHO It's not good to place use tstatements into loops or if(){}s. 
They will still be executed before the script starts running and will 
only be executed once. Therefore this may be misleading.

>       ref ($sender = new Mail::Sender({from => $ifrom,smtp => 
$smtp_server}))
>               or die "$Mail::Sender::Error\n";

Why don't you create the object outside the loop and then reuse it? 
That's why it's an object!

>       (ref ($sender->MailMsg({to =>$ito, subject => $isubject, msg => 
$msg}))
>               and print ""

Why the print() statement? It doesn't print anything (unless you 
fiddled with variable $\).

>       )
>               or die "$Mail::Sender::Error\n";
> }

HTH, Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to