Hi, I'm trying some code to send a mail with my script. This is it: - #!/usr/bin/perl
-
use Net::SMTP;
-
-
my $smtp_server='62.193.245.15';
-
my $smtp = Net::SMTP->new($smtp_server) or die "Can't Open server\n";
-
$smtp->mail('joao.correia@tvn.pt');
-
$smtp->to('jcor@sapo.pt');
-
$smtp->auth("joao.correia@tvn.pt","*password*");
-
$smtp->data();
-
$smtp->datasend("To: jcor@sapo.pt\n");
-
$smtp->datasend("From: joao.correia@tvn.pt\n");
-
$smtp->datasend("Subject: test\n");
-
$smtp->datasend("\n");
-
$smtp->datasend("some test text");
-
$smtp->dataend();
-
-
$smtp->quit;
My problem is that it allways die when creating the object. It's not possible to create the objectwith the IP instead of smtp."something"?
Is this IP that I have in my thunderbird and it works perfectly!
Am I failing something?
Can someone give me an hand?
Thanks,
Joćo Correia
13 6760
Hi, I'm trying some code to send a mail with my script. This is it: - #!/usr/bin/perl
-
use Net::SMTP;
-
-
my $smtp_server='62.193.245.15';
-
my $smtp = Net::SMTP->new($smtp_server) or die "Can't Open server\n";
-
$smtp->mail('joao.correia@tvn.pt');
-
$smtp->to('jcor@sapo.pt');
-
$smtp->auth("joao.correia@tvn.pt","*password*");
-
$smtp->data();
-
$smtp->datasend("To: jcor@sapo.pt\n");
-
$smtp->datasend("From: joao.correia@tvn.pt\n");
-
$smtp->datasend("Subject: test\n");
-
$smtp->datasend("\n");
-
$smtp->datasend("some test text");
-
$smtp->dataend();
-
-
$smtp->quit;
My problem is that it allways die when creating the object. It's not possible to create the objectwith the IP instead of smtp."something"?
Is this IP that I have in my thunderbird and it works perfectly!
Am I failing something?
Can someone give me an hand?
Thanks,
Joćo Correia
How about this, change this line: -
my $smtp = Net::SMTP->new($smtp_server) or die "Can't Open server\n";
-
to be: -
my $smtp = Net::SMTP->new($smtp_server) or die "Can't Open server: $!\n";
-
and let us know what is printed out for the error after "Can't Open server". That will be the error that is being kicked back.
Regards,
Jeff
Just to let you know, when I telnet, it doesn't let me in:
>>telnet 62.193.245.15 25
Connecting To 62.193.245.15...Could not open connection to the host, on port 25:
Connect failed
If this holds true, I don't think it is accepting connections from outside. Is this an internal SMTP server for tvnet.pt?
Regards,
Jeff
It should retrieve in my console, right?
I got nothing, I run only this code: -
use Net::SMTP;
-
my $smtp_server='62.193.245.15';
-
my $smtp = Net::SMTP->new($smtp_server) or die "Can't Open server: $!\n";
-
$smtp->quit;
-
and this is my console: - joao@joao-UBUNTU:~/Desktop$ perl Net_SMTP
-
Can't Open server:
-
joao@joao-UBUNTU:~/Desktop$
Should I see the error in some filehandle, or something?
answering to your second post,I use that IP in my thunderbird smtp server and I send mails everywhere, I guess it's the correct smtp server.
answering to your second post,I use that IP in my thunderbird smtp server and I send mails everywhere, I guess it's the correct smtp server.
You will have to bear with me as I don't have a ton of experience with this module, but from the documentation on CPAN, why not try this: -
-
$smtp = Net::SMTP->new('mailhost',
-
Hello => 'my.mail.domain',
-
Timeout => 30,
-
Debug => 1,
-
);
-
If you read the link, you will see what each of the options does for you.
Regards,
Jeff
Hi, I decided to use other email account because maybe my smtp vould be with any problem, I don't know.
My code now is this: - #!/usr/bin/perl
-
-
use Net::SMTP;
-
-
my $smtp_server='smtp.mail.yahoo.com.br';
-
my $smtp_to='joao_correia_0509@yahoo.com.br';
-
my $smtp_auth='joao_correia_0509';
-
my $smtp_pass='***password****';
-
my $smtp_mail="yahoo";
-
-
my $smtp = Net::SMTP->new($smtp_server,
-
Timeout => 30,
-
Debug => 1,
-
) or die "Can't Open server: $!\n";
-
$smtp->auth($smtp_auth,$smtp_pass) or die "in auth: $!\n";
-
$smtp->to($smtp_to) or die "in to: $!\n";
-
$smtp->data();
-
$smtp->datasend("test it ");
-
$smtp->dataend();
-
print $smtp->domain();
-
print "it's gone!!!\n";
-
$smtp->quit;
-
Now it connects to the server but gives a error in the authorization. This is the output with the debug: - joao@joao-UBUNTU:~/Desktop$ perl Net_SMTP
-
Net::SMTP>>> Net::SMTP(2.31)
-
Net::SMTP>>> Net::Cmd(2.29)
-
Net::SMTP>>> Exporter(5.58)
-
Net::SMTP>>> IO::Socket::INET(1.29)
-
Net::SMTP>>> IO::Socket(1.29)
-
Net::SMTP>>> IO::Handle(1.25)
-
Net::SMTP=GLOB(0x82da17c)<<< 220 smtp108.mail.mud.yahoo.com ESMTP
-
Net::SMTP=GLOB(0x82da17c)>>> EHLO localhost.localdomain
-
Net::SMTP=GLOB(0x82da17c)<<< 250-smtp108.mail.mud.yahoo.com
-
Net::SMTP=GLOB(0x82da17c)<<< 250-AUTH LOGIN PLAIN XYMCOOKIE
-
Net::SMTP=GLOB(0x82da17c)<<< 250-PIPELINING
-
Net::SMTP=GLOB(0x82da17c)<<< 250 8BITMIME
-
in auth: Ficheiro ou directoria inexistente
-
The last line translation is "in auth: file or folder nonexistent", or something similar.
Can you help in this?
Or, in last case, can someone give me another module or something to send a mail from the script?
Thanks,
Joćo
thanks
I too have not messed with Net::Smtp, I prefer Mail::Sendmail or Mime::Lite. In addition to those, there are many modules for email on CPAN. Here is an excerpt from the Mail::Sendmail module. - use Mail::Sendmail;
-
-
%mail = ( To => 'you@there.com',
-
From => 'me@here.com',
-
Message => "This is a very short message"
-
);
-
-
sendmail(%mail) or die $Mail::Sendmail::error;
-
-
print "OK. Log says:\n", $Mail::Sendmail::log;
What OS are you using? Don't think that the authentication works correctly on a windows machine. If that is the case that you might look at Net::SMTP::TLS.
--Kevin
The only time I did play with this module, it was with a mail server that was internal and on the network that I was connected with. So, connecting and sending email was a breeze and it worked like a charm, I must say. Unfortunately, I haven't done anything with authentication, although I should. I would check the module(s) that Kevin suggested and see if any of them work for you.
Regards,
Jeff
I'm using Ubuntu 7.04
I'll take a look in the modules you told me.
But to use Mail::SendMail I'll have to configure "sendmail" in my ubuntu, right?
I'll try that
Thanks for your help,
Joćo
I now trying to use this module MIME::Lite;
Seems pretty easy but doesn't work either.
my code is just: - #!/usr/bin/perl
-
-
use MIME::Lite;
-
-
### Create a new single-part message, to send a GIF file:
-
$msg = MIME::Lite->new(
-
From =>'joao.correia.tvnet@gmail.com',
-
To =>'jcor@net.sapo.pt',
-
Subject =>'Helloooooo, nurse!',
-
Data =>"How's it goin', eh?"
-
);
-
MIME::Lite->send( 'smtp','smtp.gmail.com',Timeout=>60,
-
Debug=>1);
-
-
$msg ->send();
-
-
print" a mensagem foi enviada com sucesso\n";
-
The debugger gives me this: - joao@joao-UBUNTU:~/Desktop$ perl Send
-
MIME::Lite::SMTP>>> MIME::Lite::SMTP
-
MIME::Lite::SMTP>>> Net::SMTP(2.31)
-
MIME::Lite::SMTP>>> Net::Cmd(2.29)
-
MIME::Lite::SMTP>>> Exporter(5.58)
-
MIME::Lite::SMTP>>> IO::Socket::INET(1.29)
-
MIME::Lite::SMTP>>> IO::Socket(1.29)
-
MIME::Lite::SMTP>>> IO::Handle(1.25)
-
MIME::Lite::SMTP=GLOB(0x83fae0c)<<< 220 mx.google.com ESMTP m5sm11074509gve.11
-
MIME::Lite::SMTP=GLOB(0x83fae0c)>>> EHLO localhost.localdomain
-
MIME::Lite::SMTP=GLOB(0x83fae0c)<<< 250-mx.google.com at your service, [81.193.137.56]
-
MIME::Lite::SMTP=GLOB(0x83fae0c)<<< 250-SIZE 28311552
-
MIME::Lite::SMTP=GLOB(0x83fae0c)<<< 250-8BITMIME
-
MIME::Lite::SMTP=GLOB(0x83fae0c)<<< 250-STARTTLS
-
MIME::Lite::SMTP=GLOB(0x83fae0c)<<< 250 ENHANCEDSTATUSCODES
-
MIME::Lite::SMTP=GLOB(0x83fae0c)>>> MAIL FROM:<joao.correia.tvnet@gmail.com>
-
MIME::Lite::SMTP=GLOB(0x83fae0c)<<< 530 5.7.0 Must issue a STARTTLS command first m5sm11074509gve.11
-
SMTP mail() command failed:
-
5.7.0 Must issue a STARTTLS command first m5sm11074509gve.11
-
Do you guys knows what's the problem here?
And do I allways have to use an "external smtp" (if you understand what I mean)? is not possible to simply send an e-mail for localhost, something like that? (maybe this is just a dummy question, I'm not really sure)
Thanks for your time anyway
Joćo
- #!/usr/bin/perl
-
-
use MIME::Lite;
-
-
### Create a new single-part message, to send a GIF file:
-
$msg = MIME::Lite->new(
-
From =>'joao.correia.tvnet@gmail.com',
-
To =>'jcor@net.sapo.pt',
-
Subject =>'Helloooooo, nurse!',
-
Data =>"How's it goin', eh?"
-
);
-
MIME::Lite->send( 'smtp','smtp.gmail.com',Timeout=>60,
-
Debug=>1);
-
-
$msg ->send();
-
-
print" a mensagem foi enviada com sucesso\n";
-
Where do you do authentication? I would not doubt that when accessing an external service like this, that you are going to have to do some sort of authentication with a user name and password. If not, then anybody, account or not, could send email through there. You should read up on each module and how they handle the authentication. I think that has been the issue all along, that you aren't authenticating to send/receive email.
Regards,
Jeff
Hi guys,
My script is working now,
my code is (adapted from one from de internet): - #!/usr/bin/perl
-
use strict;
-
use MIME::Lite;
-
-
#
-
$to = "joao.correia.tvnet\@gmail.com";
-
$from = "joao_correia_0509\@yahoo.com.br";
-
$subject = "Consegui!!!! Email enviado através de um script Perl";
-
$message = "Se ler esta mensagem é porque estį mesmo a funcionar!!!";
-
-
-
# send email
-
email($to, $from, $subject, $message);
-
-
# email function
-
sub email {
-
# get incoming parameters
-
local ($to, $from, $subject, $message) = @_;
-
-
# create a new message
-
$msg = MIME::Lite->new(
-
From => $from,
-
To => $to,
-
Subject => $subject,
-
Data => $message
-
);
-
-
# send the email
-
MIME::Lite->send('smtp',
-
'smtp.mail.yahoo.com.br', Timeout => 60, Debug =>1,
-
AuthUser=>'joao_correia_0509', AuthPass=>'***pass***');
-
-
$msg->send();
-
-
}
-
thanks again for your help
Joćo
Now, if you were to investigate the documentation for Net::SMTP, you would probably see something similar to allow you to put the authentication user name and pwd in there as well.
Regards,
Jeff
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Almir |
last post by:
I hate this Net::SMTP stuff, everything works fine but for the suject
field. I see no way of having it show in an email when sent. Has
anyone had this problem, can anyone explain why there are no...
|
by: RandRace |
last post by:
I'm having some problems with a little script i wrote using net::smtp.
I originally wrote it in linux where it works perfectly. I tried to
use it from windows the other day and it doesn't work. It...
|
by: peterson |
last post by:
I was trying to send asp.net-smtp mail of UTF-8 unicode
international character contents. When I opened the
mailbox contents was broken. I am using html format too.
Am I missing something?
|
by: neog |
last post by:
I'm having a problem with Net::Smtp. Does the datasend() method have problems sending strings containing single quotes?
Like I stored the string "Germany's biggest bank, hired" in a hash and it...
|
by: patrickinminneapolis |
last post by:
Hi guys,
I'm trying to write an emailer, but I can't manage to construct the object properly. Here's what I've got:
#!/usr/local/bin/perl -w
use Net::SMTP;
$smtp =...
|
by: =?Utf-8?B?V0o=?= |
last post by:
Hi,
I'm looking for a ASP.NET open source social network software to build a
web-site. so far, I have no luck.
If you have any information, can you help? Thanks.
WJ
|
by: jimhill10 |
last post by:
I have a perl script that creates an email attachment file from POST data on a web page. This works just fine. I want to customize the email body to contain all of the text data from the file...
|
by: wootmaster |
last post by:
I'm writing a script that will run a few tests on a given mail server, it's meant to test to see if VRFY and EXPN is enabled or not. However, when I use "verify" to test to see if VRFY is enabled on...
|
by: veralee |
last post by:
I'm in dire need to use Net::SMTP. The server no longer uses "sendmail". I found an example of using Net::SMTP but I have to also include a user name and password for the server. The host provided...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM).
In this month's session, the creator of the excellent VBE...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Aftab Ahmad |
last post by:
Hello Experts!
I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
| |