#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    5
    Rep 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... ?
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,607
    Rep Power
    4247
    Ask your sys admin if they support SMTP in the first place or not. I'm guessing they don't, which explains the "Unable to connect to server" message. Or perhaps they use a different SMTP server for sending mail (LDAP is a different protocol from SMTP and used for a different purpose).
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo

IMN logo majestic logo threadwatch logo seochat tools logo