Code Comments
Programming Forum and web based access to our favorite programming groups.hi
i tried to send email in my tk application using Net::SMTP
my $smtp = Net::SMTP->new('10.10.10.10',Hello=>'server', Timeout=>60);
# connect to an SMTP server
$smtp->mail("TEST"); # use the sender's address here
$smtp->to(@to);
$smtp->cc(@cc);
$smtp->data(); # Start the mail
$smtp->datasend("To:@to\n");
$smtp->datasend("Subject:Test\n");
$smtp->datasend("cc:@cc\n");
$smtp->datasend("\n");
$smtp->datasend("A simple test.");
$smtp->dataend(); # Finish sending the mail
$smtp->quit; # Close the SMTP connection
but i didn't work. There's no email sent
When i try it in a command line version, it works.
Does tk have any restriction on sending email through Net::SMTP
package?
thanks
Post Follow-up to this messageOn 22 Nov 2004 20:35:42 -0800, s99999999s2003@yahoo.com (mike) wrote:
>hi
>
>i tried to send email in my tk application using Net::SMTP
>my $smtp = Net::SMTP->new('10.10.10.10',Hello=>'server', Timeout=>60);
># connect to an SMTP server
>$smtp->mail("TEST"); # use the sender's address here
>$smtp->to(@to);
>$smtp->cc(@cc);
>$smtp->data(); # Start the mail
>$smtp->datasend("To:@to\n");
>$smtp->datasend("Subject:Test\n");
>$smtp->datasend("cc:@cc\n");
>$smtp->datasend("\n");
>$smtp->datasend("A simple test.");
>$smtp->dataend(); # Finish sending the mail
>$smtp->quit; # Close the SMTP connection
>
>but i didn't work. There's no email sent
>When i try it in a command line version, it works.
>Does tk have any restriction on sending email through Net::SMTP
>package?
>thanks
It should work with no problem from Tk. Maybe you don't
have it setup right? You don't show any Tk code.
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
Post Follow-up to this messages99999999s2003@yahoo.com (mike) wrote in message news:<dfd17ef4.0411222035.375320c@posting.
google.com>...
> hi
>
> i tried to send email in my tk application using Net::SMTP
> my $smtp = Net::SMTP->new('10.10.10.10',Hello=>'server', Timeout=>60);
> # connect to an SMTP server
> $smtp->mail("TEST"); # use the sender's address here
> $smtp->to(@to);
> $smtp->cc(@cc);
> $smtp->data(); # Start the mail
> $smtp->datasend("To:@to\n");
> $smtp->datasend("Subject:Test\n");
> $smtp->datasend("cc:@cc\n");
> $smtp->datasend("\n");
> $smtp->datasend("A simple test.");
> $smtp->dataend(); # Finish sending the mail
> $smtp->quit; # Close the SMTP connection
>
> but i didn't work. There's no email sent
> When i try it in a command line version, it works.
> Does tk have any restriction on sending email through Net::SMTP
> package?
> thanks
Please take a look at my Perl/TK email program:
https://sourceforge.net/projects/ezemail/
This should give you a pretty good idea of how to get it to send w/
TK. Specifically, look in "sub doSmtp" routine. While we're on the
subject, I have another question for all you Perl/TK gurus:
How can I capture the textvariable in an entry box for the sole
purpose of sending the email to multiple recipients? I know this
basic question has been asked numerous times, but I have searched over
600 posts on NET::SMTP (honest!) over the past two days and have not
found a suitable answer as it relates to Perl/TK. My code will send
it to one email correctly, but will not send it to anyone in the "CC"
line if multiple recipients are entered (they are seperated by
commas).
Here's the relevant code:
my $entry2 = $frame2 -> Entry(-textvariable => \$ccmail,
-width => 46,
-background => 'white')
->pack(-side => 'left',
-pady => 3);
etc....
$smtp -> cc($ccmail);
etc....
$smtp -> datasend("CC: $ccmail\n");
etc....
Thanks in advance,
ikepgh
Post Follow-up to this messageOn 23 Nov 2004 19:25:26 -0800, ike@ezcyberspace.com (ikepgh) wrote:
>ikepgh wrote
>How can I capture the textvariable in an entry box for the sole
>purpose of sending the email to multiple recipients? I know this
>basic question has been asked numerous times, but I have searched over
>600 posts on NET::SMTP (honest!) over the past two days and have not
>found a suitable answer as it relates to Perl/TK. My code will send
>it to one email correctly, but will not send it to anyone in the "CC"
>line if multiple recipients are entered (they are seperated by
>commas).
>Here's the relevant code:
>my $entry2 = $frame2 -> Entry(-textvariable => \$ccmail,
> -width => 46,
> -background => 'white')
> ->pack(-side => 'left',
> -pady => 3);
>
>$smtp -> cc($ccmail);
>$smtp -> datasend("CC: $ccmail\n");
I've seen this question asked in a non-Tk setting and the
answer was To and CC takes arrays. You are feeding it a
comma-separated string...which is not an array.
So try something like:
my @cc = split ',' , $ccmail;
$smtp -> cc(@cc);
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
Post Follow-up to this messagezentara <zentara@highstream.net> wrote in message news:<9i39q09qknoclp0jp7hrd3iv2pjsp9agu0@ 4ax.com>... > On 23 Nov 2004 19:25:26 -0800, ike@ezcyberspace.com (ikepgh) wrote: > > > > > I've seen this question asked in a non-Tk setting and the > answer was To and CC takes arrays. You are feeding it a > comma-separated string...which is not an array. > > So try something like: > my @cc = split ',' , $ccmail; > $smtp -> cc(@cc); Sheeesh...That was almost too easy! Thank you so much. ikepgh
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.