Using mail()

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

    Using mail()

    I am trying to use the mail() function in my PHP script, but when I run the
    script, nothing happens. I am using Windows XP with Apache. I have the
    current versions of PHP 4, Apache 2, and MySQL.

    I think I might have to make a configuration in my php.ini file to point to
    the sendmail program or something. I don't know how to do that. Does
    anybody think they can help me with this?

    I want to be able to write a page that has a form, and then when the person
    fills the form and submits it, it gets emailed to me.


    Nick


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>
    <head>

    <base target="right">
    <title>Commen t</title>
    </head>

    <body>

    <?php

    $comment = $_POST['comment'];

    $email = $_POST['email'];

    $toaddress = 'mudgen@operama il.com';
    $subject = 'Cool';
    $mailcontent = $comment;
    $fromaddress ='From: mark1822@hotmai l.com';

    mail($toaddress , $subject, $mailcontent);
    ?>
    </body>
    </html>


  • Garp

    #2
    Re: Using mail()


    "Nick Mudge" <mark1822@hotma il.com> wrote in message
    news:LyHkc.2234 $Ia6.285084@att bi_s03...[color=blue]
    > I am trying to use the mail() function in my PHP script, but when I run[/color]
    the[color=blue]
    > script, nothing happens. I am using Windows XP with Apache. I have the
    > current versions of PHP 4, Apache 2, and MySQL.
    >
    > I think I might have to make a configuration in my php.ini file to point[/color]
    to[color=blue]
    > the sendmail program or something. I don't know how to do that. Does
    > anybody think they can help me with this?[/color]

    In PHP.INI:

    [mail function]
    ; For Win32 only.
    SMTP = localhost

    ; For Win32 only.
    sendmail_from = me@localhost.co m

    ; For Unix only. You may supply arguments as well (default:
    'sendmail -t -i').
    ;sendmail_path =

    HTH
    Garp


    Comment

    • Nick Mudge

      #3
      Re: Using mail()

      My php.ini is set up that way, and it still doesn't work, does anybody have
      any suggestions?


      "Garp" <garp7@no7.blue yonder.co.uk> wrote in message
      news:G2Ikc.1893 $ia4.17447100@n ews-text.cableinet. net...[color=blue]
      >
      > "Nick Mudge" <mark1822@hotma il.com> wrote in message
      > news:LyHkc.2234 $Ia6.285084@att bi_s03...[color=green]
      > > I am trying to use the mail() function in my PHP script, but when I run[/color]
      > the[color=green]
      > > script, nothing happens. I am using Windows XP with Apache. I have the
      > > current versions of PHP 4, Apache 2, and MySQL.
      > >
      > > I think I might have to make a configuration in my php.ini file to point[/color]
      > to[color=green]
      > > the sendmail program or something. I don't know how to do that. Does
      > > anybody think they can help me with this?[/color]
      >
      > In PHP.INI:
      >
      > [mail function]
      > ; For Win32 only.
      > SMTP = localhost
      >
      > ; For Win32 only.
      > sendmail_from = me@localhost.co m
      >
      > ; For Unix only. You may supply arguments as well (default:
      > 'sendmail -t -i').
      > ;sendmail_path =
      >
      > HTH
      > Garp
      >
      >[/color]


      Comment

      • Pedro Graca

        #4
        Re: Using mail()

        Nick Mudge top-posted [corrected]:[color=blue]
        > "Garp" <garp7@no7.blue yonder.co.uk> wrote in message
        > news:G2Ikc.1893 $ia4.17447100@n ews-text.cableinet. net...[color=green]
        >> In PHP.INI:
        >>
        >> [mail function]
        >> ; For Win32 only.
        >> SMTP = localhost
        >>
        >> ; For Win32 only.
        >> sendmail_from = me@localhost.co m[/color][/color]
        [color=blue]
        > My php.ini is set up that way, and it still doesn't work, does anybody have
        > any suggestions?[/color]

        [mail function]
        SMTP = mx3.hotmail.com
        sendmail_from = mark1822@hotmai l.com


        But I believe hotmail does not allow you to use its SMTP service.
        Configure the SMTP server to the same server you have for your mail
        program and use the sender as your address there.

        --
        USENET would be a better place if everybody read: : mail address :
        http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
        http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
        http://www.expita.com/nomime.html : to 10K bytes :

        Comment

        • Nick Mudge

          #5
          Re: Using mail()

          Thanks a lot.

          SMTP = mx3.hotmail.com
          sendmail_from = mark1822@hotmai l.com

          Worked.

          "Pedro Graca" <hexkid@hotpop. com> wrote in message
          news:c70p6h$gvb ie$1@ID-203069.news.uni-berlin.de...[color=blue]
          > Nick Mudge top-posted [corrected]:[color=green]
          > > "Garp" <garp7@no7.blue yonder.co.uk> wrote in message
          > > news:G2Ikc.1893 $ia4.17447100@n ews-text.cableinet. net...[color=darkred]
          > >> In PHP.INI:
          > >>
          > >> [mail function]
          > >> ; For Win32 only.
          > >> SMTP = localhost
          > >>
          > >> ; For Win32 only.
          > >> sendmail_from = me@localhost.co m[/color][/color]
          >[color=green]
          > > My php.ini is set up that way, and it still doesn't work, does anybody[/color][/color]
          have[color=blue][color=green]
          > > any suggestions?[/color]
          >
          > [mail function]
          > SMTP = mx3.hotmail.com
          > sendmail_from = mark1822@hotmai l.com
          >
          >
          > But I believe hotmail does not allow you to use its SMTP service.
          > Configure the SMTP server to the same server you have for your mail
          > program and use the sender as your address there.
          >
          > --
          > USENET would be a better place if everybody read: : mail address :
          > http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
          > http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
          > http://www.expita.com/nomime.html : to 10K bytes :[/color]


          Comment

          Working...