Discussion:
using Mail::Sender
Graeme McLaren
2005-05-19 09:55:34 UTC
Permalink
Hi all, I'm wanting to use the Mail::Sender module. When sending emails
I'll need to use an SMTP server. On CPAN I found the following in the
documentation, is this all I would need to send email? What is the "auth"
key for? Surely all you need is a host, username and password?


if ($sender->MailMsg({
smtp => 'mail.yourISP.com',
from => '***@somewhere.com',
to =>'***@Krynicky.czX',
subject => 'this is a test',
msg => "Hi Johnie.\nHow are you?"
auth => 'NTLM',
authid => 'jenda',
authpwd => 'benda',
}) < 0) {
die "$Mail::Sender::Error\n";
}
print "Mail sent OK."


Cheers,

G :)
--
To unsubscribe, e-mail: beginners-***@perl.org
For additional commands, e-mail: beginners-***@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>
Offer Kaye
2005-05-19 10:39:54 UTC
Permalink
Post by Graeme McLaren
Hi all, I'm wanting to use the Mail::Sender module. When sending emails
I'll need to use an SMTP server. On CPAN I found the following in the
documentation, is this all I would need to send email? What is the "auth"
key for? Surely all you need is a host, username and password?
If indeed you are using a login method (username and password), then
Post by Graeme McLaren
auth => 'NTLM',
auth => 'LOGIN',
HTH,
--
Offer Kaye
--
To unsubscribe, e-mail: beginners-***@perl.org
For additional commands, e-mail: beginners-***@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>
Graeme McLaren
2005-05-19 20:11:09 UTC
Permalink
Offer, everyone, I tried sending an email from a mail server and I got an
error:

Local user "user" unknown on host "mail.smtpserver.com"


It seems to break on $email. The "user" that the error reports is the value
of $email, so why isn't it sending the email?

Offer thank you for your reply, that was helpful!


Here's the code:

######################################
my $sender=Mail::Sender->new;
if ($sender->MailMsg({
smtp => 'mail.smtpserver.com',
from => '***@mydomain.com',
to => "$email",
subject => 'test email',
msg => 'testing email',
auth => 'LOGIN',
authid => 'username',
authpwd => 'password',
}) < 0) {
die "$Mail::Sender::Error\n";
}
print "Mail sent OK."
######################################
Subject: Re: using Mail::Sender
Date: Thu, 19 May 2005 13:39:54 +0300
MIME-Version: 1.0
Received: from lists.develooper.com ([63.251.223.186]) by
mc7-f33.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Thu, 19 May 2005
03:40:02 -0700
Received: (qmail 27009 invoked by uid 514); 19 May 2005 10:39:59 -0000
Received: (qmail 27000 invoked from network); 19 May 2005 10:39:59 -0000
Received: from x1a.develooper.com (HELO x1.develooper.com) (216.52.237.111)
by lists.develooper.com with SMTP; 19 May 2005 10:39:59 -0000
Received: (qmail 12391 invoked by uid 225); 19 May 2005 10:39:59 -0000
Received: (qmail 12379 invoked by alias); 19 May 2005 10:39:58 -0000
designates 64.233.170.192 as permitted sender)
Received: from rproxy.gmail.com (HELO rproxy.gmail.com) (64.233.170.192)
by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Thu, 19 May 2005
03:39:57 -0700
Received: by rproxy.gmail.com with SMTP id z35so203936rne for
Received: by 10.38.96.6 with SMTP id t6mr930291rnb; Thu, 19 May 2005
03:39:54 -0700 (PDT)
Received: by 10.38.181.35 with HTTP; Thu, 19 May 2005 03:39:54 -0700 (PDT)
X-Message-Info: JGTYoYF78jEHjJx36Oi8+Z3TmmkSEdPtfpLB7P/ybN8=
Precedence: bulk
List-Id: <beginners.perl.org>
X-Spam-Status: No, hits=-2.5 required=8.0tests=BAYES_00,RCVD_BY_IP
X-Spam-Check-By: la.mx.develooper.com
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta;
d=gmail.com;
h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;
b=B8rPXwS0B1KoZ2FzOGjKR8lsqK/ITYI2FWtgzdaQ5tmAROABsY0hEQdNVNx+0N+xPNAV0VAYjYPuSQhqZ8g+Ms/lrT0/V95nat+DgISGgJEIXOS9fm8aAFwHJH7TaQOtAKAVPxdzmLFLoxv2QDt0OOM/T6XerR7p0yM69iFfn1Q=
X-OriginalArrivalTime: 19 May 2005 10:40:03.0785 (UTC)
FILETIME=[1D948B90:01C55C5F]
Post by Graeme McLaren
Hi all, I'm wanting to use the Mail::Sender module. When sending emails
I'll need to use an SMTP server. On CPAN I found the following in the
documentation, is this all I would need to send email? What is the
"auth"
Post by Graeme McLaren
key for? Surely all you need is a host, username and password?
If indeed you are using a login method (username and password), then
Post by Graeme McLaren
auth => 'NTLM',
auth => 'LOGIN',
HTH,
--
Offer Kaye
--
<http://learn.perl.org/> <http://learn.perl.org/first-response>
--
To unsubscribe, e-mail: beginners-***@perl.org
For additional commands, e-mail: beginners-***@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>
Offer Kaye
2005-05-20 05:14:32 UTC
Permalink
Post by Graeme McLaren
Offer, everyone, I tried sending an email from a mail server and I got an
Local user "user" unknown on host "mail.smtpserver.com"
It seems to break on $email. The "user" that the error reports is the value
of $email, so why isn't it sending the email?
to => "$email",
According to http://search.cpan.org/dist/Mail-Sender/Sender.pm#AUTHENTICATION
: "If you get a "Local user "***@yyy.com" unknown on host "zzz""
message... it only accepts messages to or from a local user."
Maybe your server doesn't like '***@mydomain.com' as a from
field? More likely, 'user' is not a valid email - try using a real
email address. I you want to use a name, the format is usually "user
<***@mydomain.com>".

HTH,
--
Offer Kaye
--
To unsubscribe, e-mail: beginners-***@perl.org
For additional commands, e-mail: beginners-***@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>
zentara
2005-05-19 10:45:56 UTC
Permalink
Post by Graeme McLaren
Hi all, I'm wanting to use the Mail::Sender module. When sending emails
I'll need to use an SMTP server. On CPAN I found the following in the
documentation, is this all I would need to send email? What is the "auth"
key for? Surely all you need is a host, username and password?
if ($sender->MailMsg({
smtp => 'mail.yourISP.com',
subject => 'this is a test',
msg => "Hi Johnie.\nHow are you?"
auth => 'NTLM',
authid => 'jenda',
authpwd => 'benda',
}) < 0) {
die "$Mail::Sender::Error\n";
}
print "Mail sent OK."
The auth is for authentication. Most ISP's now require you to
validate who you are, and some are on ports other than the standard
port 25, to get around ISP's blocking port 25.
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
--
To unsubscribe, e-mail: beginners-***@perl.org
For additional commands, e-mail: beginners-***@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>
Loading...