Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 343041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:51:37+00:00 2026-05-12T10:51:37+00:00

in my website i’ve a PHP script that automatically mails to my customers a

  • 0

in my website i’ve a PHP script that automatically mails to my customers a confirmation about the order.
My website’s domain is registered to a company that hosts my website too.
I have a lot of problems to send e-mails using mail() function to some e-mails accounts … a lot of my users contact me saying that they have never received my automatic e-mail! So this is a very big problem!

The accounts, that give me more problems, are comcast.net, uol.com, mchsi.com and others! I’ve contacted the support center of these e-mail service providers asking for removing my ip from the block list too.

The header of the e-mail looks like this:

$header = "Sender: $from_mail\n";
$header .= "From: Account <$from_mail>\n";
$header .= "Reply-To: Account <$from_mail >\n";
$header .= "Content-Type: multipart/mixed; boundary=$mixed_boundary\n";
$header .= "Mime-Version: 1.0\n";
$header .= "X-Mailer: PHP/".phpversion()."\n";

$body = "\n--$mixed_boundary\n";
.
.
.
.
$body .= "\n\n--$mixed_boundary--";

mail($to, $subject, $body, utf8_encode($header), "-f$from_mail");

There is something that I can try to avoid this problem?
Someone knows where can I look to know what is the IP address of the server used to deliver e-mails thought the PHP mail() function?

Thanks in advance for your replies!!!


Hi,

still today some e-mail provider service such as Comcast, continue to block my IPs addresses saying that my mail server sends spams … I requested the removing from the blocklist, but their system continue block them! I don’t know what else can I do … I’ve followed your suggestions and the code look like this:

$md5 = md5(date('r', time()));
$mixed_boundary = "PHP-Mixed-$md5";
$alt_boundary = "PHP-Alt-$md5";

$header = "Sender: $from_mail\r\n";
$header .= "Errors-To: $from_mail\r\n";
$header .= "From: account <$from_mail>\r\n";
$header .= "Reply-To: $from_mail\r\n";
$header .= "Content-Type: multipart/mixed; boundary=$mixed_boundary\r\n";
$header .= "Mime-Version: 1.0\r\n";
$header .= "X-Mailer: PHP/".phpversion()."\r\n";

$body = "\n--$mixed_boundary\n";
$body .= "Content-Type: multipart/alternative; boundary=$alt_boundary\n";
.
.
.
.
$body .= "--$mixed_boundary\n";
$body .= "Content-Disposition: attachment filename=\"...\"\n";
$body .= "Content-Type: application/octet-stream; x-unix-mode=0644; name=\"...\"\n";
$body .= "Content-Transfer-Encoding: base64\n";
.
.
.
.
$body .= "\n\n--$mixed_boundary--";


mail($to, $subject, $body, utf8_encode($header), "-f$from_mail");

Suggestions?

Thanks again!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T10:51:38+00:00Added an answer on May 12, 2026 at 10:51 am

    Your message headers are not valid according to RFC2822 Internet Message Format.

    From 2.1 General Description:

    Messages are divided into lines of characters. A line is a series of
    characters that is delimited with the two characters carriage-return
    and line-feed; that is, the carriage return (CR) character (ASCII
    value 13) followed immediately by the line feed (LF) character (ASCII
    value 10). (The carriage-return/line-feed pair is usually written in
    this document as "CRLF".)

    As I pointed out in my comments, the reason why your email may work with most mail servers anyway is that they may be liberal in what they accept. There may be some mail servers, however, that will discard your messages since they don’t comply with RFC2822.

    EDIT: Although the use of "\r\n" is advocated in the PHP documentation for the mail() function, there is some debate about whether that’s really the right thing to do.

    The mail() function will communicate with the local sendmail(8) command (or whatever is configured in sendmail_path), and the line endings may be processed differently depending on what mail transfer agent implementation is used. From what I understand, sendmail(8) should be OK with "\r\n", but qmail(7) for example will replace "\r\n" with "\r\r\n", which will probably break the message.

    This all happens before the email is delivered to its final destination, so it may be easily tested whether the line endings are processed properly by sending one’s self an email message constructed with "\r\n" and by verifying that all headers are present.

    See also: RFC2822, PHP mail() function, sendmail(8), qmail(7)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 188k
  • Answers 188k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Update: See this article in my blog for the more… May 12, 2026 at 5:33 pm
  • Editorial Team
    Editorial Team added an answer I believe Fluent-NHibernate relies on the nice features provided by… May 12, 2026 at 5:33 pm
  • Editorial Team
    Editorial Team added an answer I'm sure you know, by now, that this is the… May 12, 2026 at 5:33 pm

Related Questions

In My Website I have main urls such as h**p://www.sy-stu.com/stu/music.php The Title of the
in my website i've a PHP script that automatically mails to my customers a
On my website I use PHP sessions. Session information is stored in files in
I am creating a signup form in my website. I want to implement some
I want to change the language in my website. I thought i could do

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.