How can I test php mail?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Adams-Blake Co.

    How can I test php mail?

    This may be OT a bit, so maybe someone can point me in the right direction.

    I want to test a script that sends out an e-mail. I want to test it locally
    on my Mandrake Linux 8.2 box.

    It runs OK on my host (pair.com) but I have to upload it each time I want to
    test it.

    Is there something I need to do in order to test locally? Do I have to set up
    an SMTP server? Is that hard? Anything else needs to be done? CAN any of this
    be done... or is it worth the trouble?

    Thanks for any pointers.

    Al

  • JerryH

    #2
    Re: How can I test php mail?


    For PHP/Apache to send emails, you only have to have a working SMTP service
    on your Linux box. You should, in theory, be able to run it locally if you
    can send mail using "sendmail" command in linux.

    The issues you could run into are:

    1. Your ISP blocks you from sending mail other than via their SMTP server
    (this is a new trend).
    2. You may have to configure your firewall settings on your Linux box.
    3. Your hosting company, pair.com, may use a different version of SMTP,
    different firewall settings, or other differences that could cause things
    that work at home to not work there, etc.

    If you already have apache and php working at home, just give it a try. If
    it fails, then focus on configuring SMTP and test with the sendmail command
    until that works. Then you should be in business.

    Jerry


    "Adams-Blake Co." <atakeoutcanton @adams.takeme.o ut.-blake.com> wrote in
    message news:bfbvvm$ugt $1@slb9.atl.min dspring.net...[color=blue]
    > This may be OT a bit, so maybe someone can point me in the right[/color]
    direction.[color=blue]
    >
    > I want to test a script that sends out an e-mail. I want to test it[/color]
    locally[color=blue]
    > on my Mandrake Linux 8.2 box.
    >
    > It runs OK on my host (pair.com) but I have to upload it each time I want[/color]
    to[color=blue]
    > test it.
    >
    > Is there something I need to do in order to test locally? Do I have to set[/color]
    up[color=blue]
    > an SMTP server? Is that hard? Anything else needs to be done? CAN any of[/color]
    this[color=blue]
    > be done... or is it worth the trouble?
    >
    > Thanks for any pointers.
    >
    > Al
    >[/color]


    Comment

    • Louis-Philippe Huberdeau

      #3
      Re: How can I test php mail?

      Well, I think Mandrake installs and configures a SMTP server, so it
      should already be working. Otherwise, you can place your ISP's SMTP
      server in your php.ini configuration.

      Adams-Blake Co. wrote:[color=blue]
      > This may be OT a bit, so maybe someone can point me in the right direction.
      >
      > I want to test a script that sends out an e-mail. I want to test it locally
      > on my Mandrake Linux 8.2 box.
      >
      > It runs OK on my host (pair.com) but I have to upload it each time I want to
      > test it.
      >
      > Is there something I need to do in order to test locally? Do I have to set up
      > an SMTP server? Is that hard? Anything else needs to be done? CAN any of this
      > be done... or is it worth the trouble?
      >
      > Thanks for any pointers.
      >
      > Al
      >[/color]

      Comment

      • Adams-Blake Co.

        #4
        Re: How can I test php mail?

        Louis-Philippe Huberdeau wrote:
        [color=blue]
        > Well, I think Mandrake installs and configures a SMTP server, so it
        > should already be working. Otherwise, you can place your ISP's SMTP
        > server in your php.ini configuration.
        >
        > Adams-Blake Co. wrote:[color=green]
        >> This may be OT a bit, so maybe someone can point me in the right direction.
        >>
        >> I want to test a script that sends out an e-mail. I want to test it locally
        >> on my Mandrake Linux 8.2 box.
        >>
        >> It runs OK on my host (pair.com) but I have to upload it each time I want
        >> to test it.
        >>
        >> Is there something I need to do in order to test locally? Do I have to set
        >> up an SMTP server? Is that hard? Anything else needs to be done? CAN any of
        >> this be done... or is it worth the trouble?
        >>
        >> Thanks for any pointers.
        >>
        >> Al
        >>[/color][/color]


        Hmmm. If there is an SMTP server installed, I don't know about it. How could
        I tell?
        [color=blue]
        > Otherwise, you can place your ISP's SMTP
        > server in your php.ini configuration.[/color]

        I can? Where? This would be the easiest solution.... to put the address of
        Mindspring there. I'll check out the php.ini but can you give me a hint as to
        which (of the many) parms it is?

        Thanks,
        Al


        Comment

        • Jamie C

          #5
          Re: How can I test php mail?

          "Adams-Blake Co." <atakeoutcanton @adams.takeme.o ut.-blake.com> wrote in
          message news:bfbvvm$ugt $1@slb9.atl.min dspring.net...[color=blue]
          > This may be OT a bit, so maybe someone can point me in the right[/color]
          direction.[color=blue]
          >
          > I want to test a script that sends out an e-mail. I want to test it[/color]
          locally[color=blue]
          > on my Mandrake Linux 8.2 box.
          >
          > It runs OK on my host (pair.com) but I have to upload it each time I want[/color]
          to[color=blue]
          > test it.
          >
          > Is there something I need to do in order to test locally? Do I have to set[/color]
          up[color=blue]
          > an SMTP server? Is that hard? Anything else needs to be done? CAN any of[/color]
          this[color=blue]
          > be done... or is it worth the trouble?
          >
          > Thanks for any pointers.
          >
          > Al
          >[/color]

          If you dont have sendmail instaled and/or dont want to install there is a
          free perl sendmail wrapper available from --

          just tell your php.ini file where to find it and give it your isp's smtp
          details,

          just an option.?


          Comment

          • Louis-Philippe Huberdeau

            #6
            Re: How can I test php mail?

            I don't know the exact name but searching for smtp in the file will lead
            you close to it, read the comments. The value is probably set to
            localhost right now (default value).

            Adams-Blake Co. wrote:[color=blue]
            > Louis-Philippe Huberdeau wrote:
            >
            >[color=green]
            >>Well, I think Mandrake installs and configures a SMTP server, so it
            >>should already be working. Otherwise, you can place your ISP's SMTP
            >>server in your php.ini configuration.
            >>
            >>Adams-Blake Co. wrote:
            >>[color=darkred]
            >>>This may be OT a bit, so maybe someone can point me in the right direction.
            >>>
            >>>I want to test a script that sends out an e-mail. I want to test it locally
            >>>on my Mandrake Linux 8.2 box.
            >>>
            >>>It runs OK on my host (pair.com) but I have to upload it each time I want
            >>>to test it.
            >>>
            >>>Is there something I need to do in order to test locally? Do I have to set
            >>>up an SMTP server? Is that hard? Anything else needs to be done? CAN any of
            >>>this be done... or is it worth the trouble?
            >>>
            >>>Thanks for any pointers.
            >>>
            >>>Al
            >>>[/color][/color]
            >
            >
            >
            > Hmmm. If there is an SMTP server installed, I don't know about it. How could
            > I tell?
            >
            >[color=green]
            >>Otherwise, you can place your ISP's SMTP
            >>server in your php.ini configuration.[/color]
            >
            >
            > I can? Where? This would be the easiest solution.... to put the address of
            > Mindspring there. I'll check out the php.ini but can you give me a hint as to
            > which (of the many) parms it is?
            >
            > Thanks,
            > Al
            >
            >[/color]

            Comment

            • Adams-Blake Co.

              #7
              Re: How can I test php mail?

              Jamie C wrote:
              [color=blue]
              > "Adams-Blake Co." <atakeoutcanton @adams.takeme.o ut.-blake.com> wrote in
              > message news:bfbvvm$ugt $1@slb9.atl.min dspring.net...[color=green]
              >> This may be OT a bit, so maybe someone can point me in the right[/color]
              > direction.[color=green]
              >>
              >> I want to test a script that sends out an e-mail. I want to test it[/color]
              > locally[color=green]
              >> on my Mandrake Linux 8.2 box.
              >>
              >> It runs OK on my host (pair.com) but I have to upload it each time I want[/color]
              > to[color=green]
              >> test it.
              >>
              >> Is there something I need to do in order to test locally? Do I have to set[/color]
              > up[color=green]
              >> an SMTP server? Is that hard? Anything else needs to be done? CAN any of[/color]
              > this[color=green]
              >> be done... or is it worth the trouble?
              >>
              >> Thanks for any pointers.
              >>
              >> Al
              >>[/color]
              >
              > If you dont have sendmail instaled and/or dont want to install there is a
              > free perl sendmail wrapper available from --
              > http://www.elbtec.de/download/sendmail.php4
              > just tell your php.ini file where to find it and give it your isp's smtp
              > details,
              >
              > just an option.?[/color]


              I'll try it out, but I think I have sendmail installed. What does this tell
              you?

              [al@localhost al]$ su
              Password:
              [root@localhost al]# sendmail -bp
              sendmail: warning: Mail system is down -- accessing queue directly
              Mail queue is empty
              [root@localhost al]# exit

              So maybe I just need to change the php.ini to where the sendmail program is?

              Thanks,

              Al

              Comment

              • Andy Hassall

                #8
                Re: How can I test php mail?

                On Sat, 19 Jul 2003 16:16:41 -0700, "Adams-Blake Co."
                <atakeoutcanton @adams.takeme.o ut.-blake.com> wrote:
                [color=blue]
                >I'll try it out, but I think I have sendmail installed. What does this tell
                >you?
                >
                >[al@localhost al]$ su
                >Password:
                >[root@localhost al]# sendmail -bp
                >sendmail: warning: Mail system is down -- accessing queue directly[/color]

                That looks a lot like you actualy have the Postfix mail server (which
                personally I prefer to sendmail). It installs aliases so that it can be a
                drop-in replacement for sendmail.

                Try the following:

                which postfix

                If this prints out a path to the postfix executable (e.g. /usr/sbin/postfix),
                then try:

                postfix start

                This may bring your mail system up. Or it may not - it's probable that you
                have to do some minor configuration steps first; I don't know how
                pre-configured it will be on your particular distribution of Linux.

                Postfix's homepage is at:



                Configuration information at:


                [color=blue]
                >Mail queue is empty
                >[root@localhost al]# exit
                >
                >So maybe I just need to change the php.ini to where the sendmail program is?[/color]

                May not need to bother; need to start up the mail system first. If it still
                doesn't work, then yes, try filling in the sendmail_patch configuration
                variable.

                A word of caution; if your Linux machine is connected directly to the
                Internet, you should take care that your mail server is not an 'open relay', as
                these are used by spammers to do their dirty deeds. Postfix is by default
                closed to addresses outside your local network, so should be safe.

                --
                Andy Hassall (andy@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
                Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)

                Comment

                Working...