
December 16th, 2012, 09:07 PM
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 5
Time spent in forums: 29 m 13 sec
Reputation Power: 0
|
|
|
Unable to send emails from Lotus Notes
Hi,
I am trying to send emails using Perl script from Lotus Notes, here is the code i am trying
#!/usr/bin/perl
use MIME::Lite;
# Set this variable to your smtp server name
my $ServerName = ldap.servername.com";
my $from_address = 'mycompany@test.com';
my $to_address = 'myname@test.com';
my $subject = 'MIME Test: Text';
my $mime_type = 'text';
my $message_body = "Testing text in email.\n";
# Create the initial text of the message
my $mime_msg = MIME::Lite->new(
From => $from_address,
To => $to_address,
Subject => $subject,
Type => $mime_type,
Data => $message_body
)
or die "Error creating MIME body: $!\n";
# Attach the text file
my $filename = 'C:\test.txt';
my $recommended_filename = 'test.txt';
$mime_msg->attach(
Type => 'application/text',
Path => $filename,
Filename => $recommended_filename
)
or die "Error attaching text file: $!\n";
# encode body of message as a string so that we can pass it to
Net::SMTP.
my $message_body = $mime_msg->body_as_string();
# Let MIME::Lite handle the Net::SMTP details
MIME::Lite->send('smtp', $ServerName);
$mime_msg->send() or die "Error sending message: $!\n";
I am receiving Unable to connect Server, actually, my company is using LDAP protocol, but here i have mentioned "smtp" in send function, but i am not sure if this is the actual issue or not ?, could someone help me on this... ?
|