Firstly, your $email_message looks weird. There should be a blank line after the final header line. So after the "From" line, but before the "First name" line, leave a totally blank line. Not even any whitespace characters on it. That certainly could be causing issues; fix that first.

If that doesn't help, you state two different issues in your question which might seem the same, but very much are not:

If people are not receiving emails, it doesn't mean that they were never sent out. They could have been sent but lost somewhere along the way to the user's inbox, perhaps dropped by an overzealous spam filter.

You want to check your outgoing mail server log files to find out if the emails are being sent or not. That log may also have some useful information about the status codes the recipient's mail server has responded with.

If my first suggestion didn't fix things, and there's no clues in the mail log about what went wrong, then I would suggest the most common explanation is that your mail is being filtered as spam, so fixing that would be a good thing to attempt. Look into configuring your mail server to add DKIM headers to outgoing mail, and put DKIM and SPF entries into your DNS.

Oh, and by the way, your check to see if an email address is valid is pretty bad. It rejects bob-smith@bobs-furniture.com.


In reply to Re: sendmail working for me but not another by tobyink
in thread sendmail working for me but not another by kickingchicken

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.