LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 01-08-2010, 02:36 PM   #1
hawk__0
Member
 
Registered: Nov 2008
Posts: 105

Rep: Reputation: 15
Net::SMTP help, cant send email


I've tried using this supposedly "working" test example and it wont work...
Code:
					my $smtp = Net::SMTP->new('mailhost');
					$smtp->mail($ENV{USER});
					$smtp->to('myemailaddress@is.here');
					$smtp->data();
					$smtp->datasend("To: postmaster");
					$smtp->datasend("\n");
					$smtp->datasend("A simple test message\n");
					$smtp->datasend();
					$smtp->quit;
 
Old 01-08-2010, 03:25 PM   #2
zordrak
Member
 
Registered: Feb 2008
Distribution: Slackware
Posts: 595

Rep: Reputation: 115Reputation: 115
It's not Net::SMTP, but it's another way:
http://www.linuxquestions.org/questi...75#post3786475

What exactly is the problem with your example?
 
Old 01-08-2010, 04:36 PM   #3
hawk__0
Member
 
Registered: Nov 2008
Posts: 105

Original Poster
Rep: Reputation: 15
Hm... not what I'm looking for. I don't know how to use strictly PERL to send mail. That example is done with unix/linux command line tools. I already used mutt/sendmail but I am trying to work beyond that.
 
Old 01-08-2010, 05:29 PM   #4
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 15,102

Rep: Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719
Quote:
Originally Posted by hawk__0 View Post
Hm... not what I'm looking for. I don't know how to use strictly PERL to send mail. That example is done with unix/linux command line tools. I already used mutt/sendmail but I am trying to work beyond that.
It look as if you pulled some of the snippet from the CPAN.org site here:
http://search.cpan.org/~gbarr/libnet-1.22/Net/SMTP.pm

And when you say 'won't work'...what does it actually do/say? How doesn't it work? Version/distro of Linux? Is the net::smtp module loaded and installed, and is there more code than what you posted?

The link posted here should give you full usage examples. The way you've got it, it presumes your mailhost is called 'mailhost'..if it's not, it obviously won't work. Also, if that mailhost isn't set up to accept incoming relay traffic from you, or if you need user id/password, it won't work either.
 
Old 01-08-2010, 06:59 PM   #5
hawk__0
Member
 
Registered: Nov 2008
Posts: 105

Original Poster
Rep: Reputation: 15
Ubuntu 9.10, there is a lot more code to it but nothing related to that snipet itself. It's jsut a small, new portion to an existing script. It says/does nothing, the module is installed and being used with use Net::SMTP;
 
Old 01-08-2010, 08:44 PM   #6
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 15,102

Rep: Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719
Quote:
Originally Posted by hawk__0 View Post
Ubuntu 9.10, there is a lot more code to it but nothing related to that snipet itself. It's jsut a small, new portion to an existing script. It says/does nothing, the module is installed and being used with use Net::SMTP;
Ok...did you try to run it in debug mode, to see what it's doing? Is there anything in your mail relay logs?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Send email to specific SMTP servers per email from my server? neilius Linux - Server 6 06-25-2009 07:31 AM
send CLI email using googles SMTP augurseer Linux - General 1 12-06-2007 11:02 AM
Can't send email using SMTP...stuck smiley_lauf Linux - Newbie 4 01-31-2006 09:20 PM
can't send email, smtp or sendmail dtra Linux - Software 1 11-19-2005 07:00 PM
finding c++ smtp libs to send email YatseaLee Programming 0 12-05-2004 11:07 PM


All times are GMT -5. The time now is 03:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration