PHP Email

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

    PHP Email


    Hello all,

    How can i send email using PHP from my server ?
    Which settings are necessary ?

    please, guide me
    Thanks in advance.

  • Jerry Stuckle

    #2
    Re: PHP Email

    Michael Vilain wrote:
    In article <1177653012.844 881.231920@u32g 2000prd.googleg roups.com>,
    pradeep <pwpradeep@gmai l.comwrote:
    >
    >Hello all,
    >>
    >How can i send email using PHP from my server ?
    >Which settings are necessary ?
    >>
    >please, guide me
    >Thanks in advance.
    >
    RTFM:
    >

    >
    First of all, do you have an SMTP server running on your server? Does
    it require authentication?

    Depending on what you have and what you need to do, the mail() function
    could work fine. With other situations you might need a package such as
    Pear Mail to make things easier.

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

    Comment

    • Max

      #3
      Re: PHP Email

      I have a question related to this post:

      We are using 2 different Linux based servers: one for web (PHP, MySQL)
      and another for the mail (Qmail, SquirrelMail e.t.c.). Our webserver
      is co-located and mail server is installed here. For the PHP mail()
      function to be able to use the mail server, I modified php.ini for
      SMTP to pointi to the mail server' IP. Yet it still uses web server's
      sendmail as SMTP MTA.

      Please help

      Comment

      • Jerry Stuckle

        #4
        Re: PHP Email

        Max wrote:
        I have a question related to this post:
        >
        We are using 2 different Linux based servers: one for web (PHP, MySQL)
        and another for the mail (Qmail, SquirrelMail e.t.c.). Our webserver
        is co-located and mail server is installed here. For the PHP mail()
        function to be able to use the mail server, I modified php.ini for
        SMTP to pointi to the mail server' IP. Yet it still uses web server's
        sendmail as SMTP MTA.
        >
        Please help
        >
        Did you define sendmail_path in your php.ini? Also, after changing your
        php.ini, did you stop and restart your server?

        What do you have for your sendmail parameters in your php.ini?

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

        Comment

        • Tim Van Wassenhove

          #5
          Re: PHP Email

          pradeep schreef:
          Hello all,
          >
          How can i send email using PHP from my server ?
          Which settings are necessary ?
          Apart from configuring the os i'd probably opt for
          swift mailer, swiftmailer, swiftmail, php mailer, phpmailer, oop mailer, bulk emailing



          --
          Tim Van Wassenhove <url:http://www.timvw.be/>

          Comment

          • Rik

            #6
            Re: PHP Email

            Michael Vilain wrote:
            In article <1177680745.238 934.146880@s33g 2000prh.googleg roups.com>,
            Max <MaximGolyuk@gm ail.comwrote:
            >
            >I have a question related to this post:
            >>
            >We are using 2 different Linux based servers: one for web (PHP, MySQL)
            >and another for the mail (Qmail, SquirrelMail e.t.c.). Our webserver
            >is co-located and mail server is installed here. For the PHP mail()
            >function to be able to use the mail server, I modified php.ini for
            >SMTP to pointi to the mail server' IP. Yet it still uses web server's
            >sendmail as SMTP MTA.
            >>
            >Please help
            >
            That's not how UNIX email works. AFAIK, php.ini tells php where the
            local mail transport agent (MTA) is located. php uses this to spawn a
            thread or perhaps even fork() a process to deliver the mail to the MTA.
            There's no provision to use "remote" MTAs.
            >
            You'll have to configure the local MTA on the web server to forward the
            mail to the mail server if you want mail delivered.
            Nonsense. PHP can just as easily use a third party SMTP server, as long
            as it's configured properly, see Jerry's reply.

            --
            Rik Wasmus

            Estimated date being able to walk again: 01-05-2007.
            Less then a week, hurray!

            Comment

            • Rik

              #7
              Re: PHP Email

              Michael Vilain wrote:
              In article <f0vppv$sft$1@n ews2.zwoll1.ov. home.nl>,
              Rik <luiheidsgoeroe @hotmail.comwro te:
              >Michael Vilain wrote:
              >>That's not how UNIX email works. AFAIK, php.ini tells php where the
              >>local mail transport agent (MTA) is located. php uses this to spawn a
              >>thread or perhaps even fork() a process to deliver the mail to the MTA.
              >>There's no provision to use "remote" MTAs.
              >>>
              >>You'll have to configure the local MTA on the web server to forward the
              >>mail to the mail server if you want mail delivered.
              >Nonsense. PHP can just as easily use a third party SMTP server, as long
              >as it's configured properly, see Jerry's reply.
              >
              OK, I'll say it --slowly-- for you. AFAIK, php.ini won't allow
              configuration to a REMOTE SMTP server on LINUX or UNIX systems.
              Je m'excuse. Indeed the only hosts where I had to use a different SMTP
              seem to be Windows hosts.... Where it's no problem to use a different one.


              --
              Rik Wasmus

              Estimated date being able to walk again: 01-05-2007.
              Less then a week, hurray!

              Comment

              • Max

                #8
                Re: PHP Email

                I have read the php.net mail manual and am aware of the SMTP MTA
                Windows redirect. The manual reads that php.ini SMTP string can be
                configured for Windows servers only. I am aware of that. What I am
                trying to accomplish is - to make it work in Linux setup.

                Here is our scenario:

                We have the following setup (I am rewriting the actual values for
                security purposes):
                The mail server's IP is 111.111.111.111 which resolves to
                mail.mysite.com
                The webserver's IP is 222.222.222.222 which is www.mysite.com or
                mysite.com

                To prevent increasing SPAM attacks we modified the Mail MX records to
                point to our ISP, which has the SPAM filter installed on their server
                (121.121.121.12 1). All the SPAM filter does is - it strips sender
                email's domain part and verifying it with sender's IP. If it is a
                match, then ISP's server relying it to our mail server
                (222.222.222.22 2)

                Webserver's sendmail is working properly, but what happens is:
                111.111.111.111 -121.121.121.121 X 222.222.222.222

                When the email is originated at 111.111.111.111 - mail.mysite.com
                (using PHP mail() function), the ISP's filter reads the sender email
                address, compares it with IP, arrests the email, replying "You are not
                222.222.222.222 " and tries to bounce it back to 111.111.111.111 .

                We need to bypass that route for mail originated on the webserver,
                hopefully by rewriting php.ini.

                Comment

                • Max

                  #9
                  Re: PHP Email

                  I have tried rewriting php.ini, yet it did not produce desired
                  results.
                  Is there any other way, other than rewriting mail() function with our
                  own SMTP handler?

                  Comment

                  • Jerry Stuckle

                    #10
                    Re: PHP Email

                    Max wrote:
                    I have read the php.net mail manual and am aware of the SMTP MTA
                    Windows redirect. The manual reads that php.ini SMTP string can be
                    configured for Windows servers only. I am aware of that. What I am
                    trying to accomplish is - to make it work in Linux setup.
                    >
                    Here is our scenario:
                    >
                    We have the following setup (I am rewriting the actual values for
                    security purposes):
                    The mail server's IP is 111.111.111.111 which resolves to
                    mail.mysite.com
                    The webserver's IP is 222.222.222.222 which is www.mysite.com or
                    mysite.com
                    >
                    To prevent increasing SPAM attacks we modified the Mail MX records to
                    point to our ISP, which has the SPAM filter installed on their server
                    (121.121.121.12 1). All the SPAM filter does is - it strips sender
                    email's domain part and verifying it with sender's IP. If it is a
                    match, then ISP's server relying it to our mail server
                    (222.222.222.22 2)
                    >
                    Webserver's sendmail is working properly, but what happens is:
                    111.111.111.111 -121.121.121.121 X 222.222.222.222
                    >
                    When the email is originated at 111.111.111.111 - mail.mysite.com
                    (using PHP mail() function), the ISP's filter reads the sender email
                    address, compares it with IP, arrests the email, replying "You are not
                    222.222.222.222 " and tries to bounce it back to 111.111.111.111 .
                    >
                    We need to bypass that route for mail originated on the webserver,
                    hopefully by rewriting php.ini.
                    >
                    Max,

                    Looks like you need to change the rules on your mail server to accept
                    (and relay) mail from 111.111.111.111 .


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

                    Comment

                    • Max

                      #11
                      Re: PHP Email

                      Our mail server accepts emails from the webserver. Our emails are
                      going through default MX records, which point to our ISP server, which
                      does relay emails to our mail server. Simply put, I want to bypass the
                      MX record (which points to the ISP server's SPAM filter, which works
                      for us for all other mail, we have no control over)

                      Comment

                      • Max

                        #12
                        Re: PHP Email

                        On Apr 27, 9:30 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                        Max wrote:
                        I have a question related to this post:
                        >
                        We are using 2 different Linux based servers: one for web (PHP, MySQL)
                        and another for the mail (Qmail, SquirrelMail e.t.c.). Our webserver
                        is co-located and mail server is installed here. For the PHP mail()
                        function to be able to use the mail server, I modified php.ini for
                        SMTP to pointi to the mail server' IP. Yet it still uses web server's
                        sendmail as SMTP MTA.
                        >
                        Please help
                        >
                        Did you define sendmail_path in your php.ini? Also, after changing your
                        php.ini, did you stop and restart your server?
                        >
                        What do you have for your sendmail parameters in your php.ini?
                        >
                        --
                        =============== ===
                        Remove the "x" from my email address
                        Jerry Stuckle
                        JDS Computer Training Corp.
                        jstuck...@attgl obal.net
                        =============== ===
                        The sendmail_path in php.ini was commented out. I have uncommened it
                        and set the value to nothing. I did restart Apache after that.

                        Comment

                        • Jerry Stuckle

                          #13
                          Re: PHP Email

                          Max wrote:
                          Our mail server accepts emails from the webserver. Our emails are
                          going through default MX records, which point to our ISP server, which
                          does relay emails to our mail server. Simply put, I want to bypass the
                          MX record (which points to the ISP server's SPAM filter, which works
                          for us for all other mail, we have no control over)
                          >
                          In that case you'd have to look at your Unix/Linux configuration. PHP
                          knows nothing about MX records.

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

                          Comment

                          • Jerry Stuckle

                            #14
                            Re: PHP Email

                            Max wrote:
                            On Apr 27, 9:30 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                            >Max wrote:
                            >>I have a question related to this post:
                            >>We are using 2 different Linux based servers: one for web (PHP, MySQL)
                            >>and another for the mail (Qmail, SquirrelMail e.t.c.). Our webserver
                            >>is co-located and mail server is installed here. For the PHP mail()
                            >>function to be able to use the mail server, I modified php.ini for
                            >>SMTP to pointi to the mail server' IP. Yet it still uses web server's
                            >>sendmail as SMTP MTA.
                            >>Please help
                            >Did you define sendmail_path in your php.ini? Also, after changing your
                            >php.ini, did you stop and restart your server?
                            >>
                            >What do you have for your sendmail parameters in your php.ini?
                            >>
                            >--
                            >============== ====
                            >Remove the "x" from my email address
                            >Jerry Stuckle
                            >JDS Computer Training Corp.
                            >jstuck...@attg lobal.net
                            >============== ====
                            >
                            The sendmail_path in php.ini was commented out. I have uncommened it
                            and set the value to nothing. I did restart Apache after that.
                            >
                            True, I forgot - that's a Windows only parameter. For Linux you need
                            sendmail or sendmail substitute on your system.

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

                            Comment

                            • Jim Carlock

                              #15
                              Re: PHP Email

                              Max wrote:
                              Our mail server accepts emails from the webserver. Our emails are
                              going through default MX records, which point to our ISP server, which
                              does relay emails to our mail server. Simply put, I want to bypass the
                              MX record (which points to the ISP server's SPAM filter, which works
                              for us for all other mail, we have no control over)
                              "Jerry Stuckle" <jstucklex@attg lobal.netwrote:
                              : In that case you'd have to look at your Unix/Linux configuration. PHP
                              : knows nothing about MX records.

                              MX is pure DNS. It points to a mail server which usually opens port
                              25 up for SMTP and port 110 for POP3. PHP tends to run under an
                              Apache server which in turn opens port 80, unless one configures
                              weird/different things with port numbers.

                              Note, every IP address includes a port number, and a full connect
                              cannot be established without supplying the 5th element of the IP
                              address (the port number).

                              11.11.11.11:80 is a different IP address than 11.11.11.11:25.

                              When an SMTP server wants to relay mail to your mail server, it
                              issues an MX (DNS) query. PHP runs underneath Apache, but
                              I thought I read something somewhere that PHP can make and
                              accept connections on other ports. Perhaps, I'm getting it mixed
                              up with some Perl things I've read?

                              Anyways, that tends to be the way I think of it all. Please correct
                              me if anything I've stated is wrong.





                              It almost appears that PHP can become a fully functional SMTP
                              server and/or POP3/IMAP server.

                              --
                              Jim Carlock
                              Post replies to the group.


                              Comment

                              Working...