Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

sending email thru Net::SMTP in TK
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

Report this thread to moderator Post Follow-up to this message
Old Post
mike
11-23-04 08:56 AM


Re: sending email thru Net::SMTP in TK
On 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

Report this thread to moderator Post Follow-up to this message
Old Post
zentara
11-23-04 08:57 PM


Re: sending email thru Net::SMTP in TK
s99999999s2003@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

Report this thread to moderator Post Follow-up to this message
Old Post
ikepgh
11-24-04 08:57 AM


Re: sending email thru Net::SMTP in TK
On 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

Report this thread to moderator Post Follow-up to this message
Old Post
zentara
11-24-04 09:00 PM


Re: sending email thru Net::SMTP in TK
zentara <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

Report this thread to moderator Post Follow-up to this message
Old Post
ikepgh
11-25-04 01:59 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PerlTk archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:26 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.