LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 01-28-2007, 08:28 PM   #1
just_a_kid
LQ Newbie
 
Registered: Dec 2006
Posts: 24

Rep: Reputation: 15
send email using PERL


I m trying to send email using MIME lite as below

Code:
#! /usr/bin/perl -w

use MIME::Lite;
use Net::SMTP;

### Adjust sender, recipient and your SMTP mailhost
my $from_address = 'am@gogo.biz';
my $to_address = 'ana@gogo.biz';
my $mail_host = 'gogo.biz';

my $authUser = 'app';
my $authPass = 'app123';

### Adjust subject and body message
my $subject = 'mail testing from 129 ';
my $message_body = "Here's the attachment file(s) you wanted";

### Adjust the filenames
my $my_file_gif = 'my_file.gif';
my $your_file_gif = 'your_file.gif';
my $my_file_zip = 'my_file.zip';
my $your_file_zip = 'your_file.zip';

### Create the multipart container
$msg = MIME::Lite->new (
  From => $from_address,
  To => $to_address,
  Subject => $subject,
  Type =>'multipart/mixed'
) or die "Error creating multipart container: $!\n";

### Add the text message part
$msg->attach (
  Type => 'TEXT',
  Data => $message_body
) or die "Error adding the text message part: $!\n";


### Send the Message
MIME::Lite->send('smtp', $mail_host, AuthUser=>$authUser, AuthPass=>$authPass)|| die "Cannot send email\n";
$msg->send_by_smtp($mail_host);

But Everytime i run the script i get this error message as below
SMTP RCPT command failed:
5.0.0 <ana@gogo.biz>... Use MXes or authenticate yourself



I am very sure the username and password is correct because if i telnet to my STMP hostname and send email using SMTP command it works.

any idea guys?
 
Old 01-29-2007, 01:14 AM   #2
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Are you sure you need to authenticate when sending? Not all SMTP hosts require this if allowed in the relay domains configuration, etc. Is gogo.biz you're own domain or your ISP domain?
 
Old 01-30-2007, 01:07 AM   #3
just_a_kid
LQ Newbie
 
Registered: Dec 2006
Posts: 24

Original Poster
Rep: Reputation: 15
Yes i need to authenticate when sending

i got this one works in java program and if i use SMTP command by telneting to my STMP server port 25 i m be able to send the email successfully after authenticating myself


i m not sure how it works in PERL
Looks okay for me but it doesnt work.

Thanks

Anyone has tried before or have the sample?
 
Old 01-31-2007, 08:11 PM   #4
just_a_kid
LQ Newbie
 
Registered: Dec 2006
Posts: 24

Original Poster
Rep: Reputation: 15
any suggestion guy?

its not neccesary to use perl script as long i can send mail using script from Solaris
by specifiying the hostname and authenticate
 
  


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
Can't send email tzpow2k2 Linux - General 3 06-29-2006 09:58 PM
email 'send' NO - email 'receive' YES..? captain skywave Linux - Wireless Networking 4 04-23-2005 04:35 AM
email 'send' YES - email 'receive' NO..? captain skywave Linux - Wireless Networking 1 04-22-2005 06:23 AM
Allowing an IP to send email using my email server... culprit Linux - Networking 7 09-09-2003 01:24 PM
sending an email to a email address after a perl operation meluser Programming 9 04-07-2003 02:26 PM


All times are GMT -5. The time now is 10:18 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