I'm installing my perl script on one server and expecting the script to send out an email to a group email address so everybody in the group can receive this email.
However after install, I noticed the emails sent to the group was not received at all.

In order to find out the reason, I wrote test scripts to test sending emails from three different servers. These three serves reside in the same network.

On each server, I tried two different methods to send email that I know so far, hoping to give better coverage for the test.
Method 1:  MIME::Lite   (which is also used in my script installed at the beginning)

my $msg = MIME::Lite->new( To => 'Alias@xxxx.com', Subject = $subject, Type => 'text/plain, Data => $message );

Method 2: system function call

open $CMD, "|/usr/bin/mailx -s \'$subject\' Alias\@xxxx.com" or die("C +annot open CMD"); print $CMD $message; close $CMD;

I tested to send the email to both the group email address and my individual email address respectively, for comparison.
The result looks interesting and I hadn't expected our servers to vary so much on this issue:

Server A: Send to group address fails    Send to individual address OK
Server B: Send to group address fails    Send to individual address fails
Server C: Send to group address fails    Send to individual address OK

My Monks, based on my tests, do you think we can locate the email problem, or does it look like it's caused by some other configurations from each of the servers?

My second question is, could you let me know if there is any better way of sending emails by perl, that's possibly safer?


Many thanks


In reply to Send email and attachement without MIME? by sylph001

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.