PHP mail() function problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • noha khalifa

    #1

    PHP mail() function problem

    Hi all,

    I want to send mails using php mail() function, my web server is
    apache on linux i just add this line to my code
    ini_set('sendma il_from', 'users@must.edu .eg');

    i'm sending emails to users at the same domain ....@must.edu.e g but it
    didn't send mail also it don't give any errors

    but i'm sure that mail server is working coz when i'm trying to send
    mails to the same domain through outlook it works well.

    i tried to send to hotmail it sends just one mail but when i tried
    again the same happened no mails sent with no error.

    where do u think the problem????
  • Jerry Stuckle

    #2
    Re: PHP mail() function problem

    noha khalifa wrote:
    Hi all,
    >
    I want to send mails using php mail() function, my web server is
    apache on linux i just add this line to my code
    ini_set('sendma il_from', 'users@must.edu .eg');
    >
    i'm sending emails to users at the same domain ....@must.edu.e g but it
    didn't send mail also it don't give any errors
    >
    but i'm sure that mail server is working coz when i'm trying to send
    mails to the same domain through outlook it works well.
    >
    i tried to send to hotmail it sends just one mail but when i tried
    again the same happened no mails sent with no error.
    >
    where do u think the problem????
    You didn't show your code, so it's impossible to tell.

    You shouldn't be using ini_set for 'sendmail_from' - that's just a
    default value. Rather, you should be using the From: header in your
    mail() command to set who it is from.

    If you were able to get one email sent to hotmail, then you are able to
    connect to an MTA. But is this MTA set up to limit the number of emails
    sent in a certain period of time?

    Additionally, how do you know the email didn't get sent? If you're
    checking to see if it has been received, that's not accurate. It could
    have been dumped by the receiving email system as spam, for instance.

    The code you're using would be a big help in helping with your problem.

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • noha khalifa

      #3
      Re: PHP mail() function problem

      This is my code

      $EMail="nkhalif a@must.edu.eg";

      $headers = 'MIME-Version: 1.0' . "\r\n";
      $headers .= 'Content-type: text/html; charset=windows-1256' . "\r\n";

      // Additional headers

      $headers .= "Bcc: nkhalifa@must.e du.eg\r\n" ;


      ini_set('sendma il_from', 'users@must.edu .eg');
      // Mail it
      mail($EMail, $subject, $message, $headers);

      Comment

      • Jessica Griego

        #4
        Re: PHP mail() function problem


        "Michael Vilain" <vilain@NOspamc op.netwrote in message
        news:vilain-A08DF5.10210412 112008@feeder.m otzarella.org.. .
        In article
        <1f0bdefb-4d89-4e6c-b9f8-506935235b4b@a1 7g2000prm.googl egroups.com>,
        <snip>
        [I filter all Goggle Groups posts, so any reply may be automatically by
        ignored]
        Why is that, Michael?


        Comment

        • Jerry Stuckle

          #5
          Re: PHP mail() function problem

          noha khalifa wrote:
          This is my code
          >
          $EMail="nkhalif a@must.edu.eg";
          >
          $headers = 'MIME-Version: 1.0' . "\r\n";
          $headers .= 'Content-type: text/html; charset=windows-1256' . "\r\n";
          >
          // Additional headers
          >
          $headers .= "Bcc: nkhalifa@must.e du.eg\r\n" ;
          >
          >
          ini_set('sendma il_from', 'users@must.edu .eg');
          // Mail it
          mail($EMail, $subject, $message, $headers);
          Rather than use ini_set, you should be adding to your header:

          "From: users@must.edu. eg\r\n"

          It often helps to also have

          "ReplyTo: users@must.edu. eg\r\n"

          Additionally, the last header should NOT have "\r\n" after it.

          You don't show what's in $subject, but that, also, should not have
          "\r\n" after it. It may be OK.

          You're also sending only html email. What about those who can't display
          html? Additionally, some spam filters will filter out html-only email
          (or at least increase the score, which might get you filtered).

          If you're going to send html email, you really should use PHPMailer. It
          does a lot of this for you, and makes your life much easier.
          Additionally, it will allow you to send the email as both text and html,
          so those who can't receive html can still see it, and spam filters are
          less likely to boot it out.

          Hope this helps.

          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstucklex@attgl obal.net
          =============== ===

          Comment

          • Jessica Griego

            #6
            Re: PHP mail() function problem


            "Michael Vilain" <vilain@NOspamc op.netwrote in message
            news:vilain-A78DD8.12141912 112008@feeder.m otzarella.org.. .
            In article <7%FSk.4285$pr6 .2319@flpi149.f fdc.sbc.com>,
            "Jessica Griego" <jess@example.c omwrote:
            >
            >"Michael Vilain" <vilain@NOspamc op.netwrote in message
            >news:vilain-A08DF5.10210412 112008@feeder.m otzarella.org.. .
            In article
            <1f0bdefb-4d89-4e6c-b9f8-506935235b4b@a1 7g2000prm.googl egroups.com>,
            >>
            ><snip>
            >>
            [I filter all Goggle Groups posts, so any reply may be automatically by
            ignored]
            >>
            >Why is that, Michael?
            >
            s/n ratio < 1
            LOL.

            Well if they can't figure out how to use a newreader, they probably do need
            a bit of coddling when they try to program. :)


            Comment

            • noha khalifa

              #7
              Re: PHP mail() function problem

              I used also phpmailer and again no emails sent :(

              Comment

              • noha khalifa

                #8
                Re: PHP mail() function problem

                I tried to change 'Content-Type: text/HTML' into 'Content-Type: text/
                plain' and it now sends to hotmail well.

                but it don't send to the other mails in the domain must.edu.eg

                Comment

                • noha khalifa

                  #9
                  Re: PHP mail() function problem

                  Sorry , but i don't know from where i can get sendmail log, my
                  webserver is on linux o/s and path of senmail is /usr/sbin/sendmail

                  Where i can find log file

                  Comment

                  • Jerry Stuckle

                    #10
                    Re: PHP mail() function problem

                    noha khalifa wrote:
                    Sorry , but i don't know from where i can get sendmail log, my
                    webserver is on linux o/s and path of senmail is /usr/sbin/sendmail
                    >
                    Where i can find log file
                    >
                    It will be under your /var/log directory - perhaps a subdirectory in
                    there. Exactly where depends on your setup.

                    And how do you know you can't send to them? It's entirely possible you
                    can send to them but it's being booted out by their server (as with your
                    problem with gmail).

                    --
                    =============== ===
                    Remove the "x" from my email address
                    Jerry Stuckle
                    JDS Computer Training Corp.
                    jstucklex@attgl obal.net
                    =============== ===

                    Comment

                    • Jerry Stuckle

                      #11
                      Re: PHP mail() function problem

                      noha khalifa wrote:
                      I used also phpmailer and again no emails sent :(
                      No mails are sent - or no mails are received? There is a huge difference.

                      --
                      =============== ===
                      Remove the "x" from my email address
                      Jerry Stuckle
                      JDS Computer Training Corp.
                      jstucklex@attgl obal.net
                      =============== ===

                      Comment

                      • noha khalifa

                        #12
                        Re: PHP mail() function problem

                        I checked the Log file and i found the following lines :

                        Nov 17 14:13:30 MUST-WebServer sendmail[2294]: mAHCDUn9002294:
                        to=28495@must.e du.eg, ctladdr=users@m ust.edu.eg (48/48),
                        delay=00:00:00, xdelay=00:00:00 , mailer=relay, pri=31760, relay=
                        [127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (mAHCDUbS002295 Message
                        accepted for delivery)

                        Nov 17 14:13:30 MUST-WebServer sendmail[2297]: mAHCDUbS002295:
                        to=<28495@must. edu.eg>, delay=00:00:00, xdelay=00:00:00 , mailer=esmtp,
                        pri=122094, relay=must.edu. eg, dsn=5.1.2, stat=Host unknown (Name
                        server: must.edu.eg: host not found)

                        Comment

                        • Charles Calvert

                          #13
                          Re: PHP mail() function problem

                          On Mon, 17 Nov 2008 23:34:49 -0800 (PST), noha khalifa
                          <ChickenLittle7 8@gmail.comwrot e in
                          <3a937f52-0a28-4745-895d-d239287b386c@h2 3g2000prf.googl egroups.com>:
                          >I checked the Log file and i found the following lines :
                          >
                          >Nov 17 14:13:30 MUST-WebServer sendmail[2294]: mAHCDUn9002294:
                          >to=28495@must. edu.eg, ctladdr=users@m ust.edu.eg (48/48),
                          >delay=00:00:00 , xdelay=00:00:00 , mailer=relay, pri=31760, relay=
                          >[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (mAHCDUbS002295 Message
                          >accepted for delivery)
                          >
                          >Nov 17 14:13:30 MUST-WebServer sendmail[2297]: mAHCDUbS002295:
                          >to=<28495@must .edu.eg>, delay=00:00:00, xdelay=00:00:00 , mailer=esmtp,
                          >pri=122094, relay=must.edu. eg, dsn=5.1.2, stat=Host unknown (Name
                          >server: must.edu.eg: host not found)
                          This second line is the one that is important. Note that it says that
                          it couldn't find the server must.edu.eg. When I run an nslookup on
                          it, I get:

                          Non-authoritative answer:
                          Name: must.edu.eg
                          Address: 192.168.5.3

                          It looks like the DNS record for this server is configured to point to
                          a nonroutable address. See
                          <http://en.wikipedia.or g/wiki/IP_address#IPv4 _private_addres sesfor
                          more info.

                          Is your server on the same network and subnet with must.edu.eg? If
                          not, you won't be able to connect to it via that domain name.
                          --
                          Charles Calvert | Web-site Design/Development
                          Celtic Wolf, Inc. | Software Design/Development
                          http://www.celticwolf.com/ | Data Conversion
                          (703) 580-0210 | Project Management

                          Comment

                          Working...