Trying to get mail() to send an email

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • howie450
    New Member
    • Sep 2007
    • 1

    Trying to get mail() to send an email

    I am a newbie to programming and know very little about php format. I can not get the php mail to function properly. Any help would be greatly appreciated..
    [code=php]
    <form action="<?=$PHP _SELF?>" method="post">




    <input type=submit value="Send Inquiry" name=Submit> <? } else {mail("abc@some bodyhelp.com"," Inquiry from www.somebodyhel p.com","$Messag e","From: $NAME <$EMAIL>
    <input type=reset value=Reset name="reset">
    [/code]

    I believe this is this the problem script.
  • ak1dnar
    Recognized Expert Top Contributor
    • Jan 2007
    • 1584

    #2
    Please read some basic examples first if you are new to Php.

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      Heya, Howie. Welcome to TSDN!

      Changed thread title to better describe the problem (did you know that threads whose titles do not follow the Posting Guidelines actually get FEWER responses?).

      Please use CODE tags when posting source code:

      &#91;CODE=ph p]
      PHP code goes here.
      &#91;/CODE]

      Comment

      • sumaiya
        New Member
        • Apr 2007
        • 43

        #4
        I think you havnt specified proper headers. [link removed] to see how to use the mail() script.

        And make sure you have uploaded the script on your website. DO NOT TEST IT ON YOUR LOCAL COMPUTER it will most probably not work.
        Last edited by pbmods; Sep 12 '07, 01:10 PM. Reason: Removed link.

        Comment

        • ak1dnar
          Recognized Expert Top Contributor
          • Jan 2007
          • 1584

          #5
          Originally posted by sumaiya
          I think you havnt specified proper headers. [link removed] to see how to use the mail() script.

          And make sure you have uploaded the script on your website. DO NOT TEST IT ON YOUR LOCAL COMPUTER it will most probably not work.
          If there you have configured a SMTP server on the LOCAL host it will work.

          If you have any known SMTP service provider, put their smtp host info in the php.ini.
          Last edited by pbmods; Sep 12 '07, 01:10 PM. Reason: Removed link.

          Comment

          • pbmods
            Recognized Expert Expert
            • Apr 2007
            • 5821

            #6
            Heya, Sumaiya.

            I removed a link to a competing forum from your post as per the site Posting Guidelines.

            Comment

            • ronverdonk
              Recognized Expert Specialist
              • Jul 2006
              • 4259

              #7
              I am a newbie to programming and know very little about php format. I can not get the php mail to function properly.
              To prevent guessing, please explain what does not function properly!
              Does the function return an error? Does it not return an error but still not send the mail? Please elaborate.

              Ronald

              Comment

              • kovik
                Recognized Expert Top Contributor
                • Jun 2007
                • 1044

                #8
                Howie, that code is very badly formatted, breaks the string, and tries to input HTML into the headers. Very strange, indeed.

                If you want to avoid dealing with the complexities of the mail() function, there's an intuitive solution known as SwiftMailer that can accomplish almost anything you'd need to do with your emails.

                Comment

                Working...