Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. Mail () function friving me crazy with the errors :@

Mail () function friving me crazy with the errors :@

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
helpphpcomquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SRJ92
    wrote on last edited by
    #1

    hello , i have been trying to sort this out for hours , and there are probably 2000 other people who have asked this but when i try and send form results to an email adress from the local host which i set up i get this : Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Apache2.2\htdocs\websites\test\process.php on line 6 here is my code in php.ini

    [mail function]
    STMP = localhost
    sendmail_from = me@whatever.com

    here is my code in the form process.php

    <?php

    $name = $_REQUEST['name'];
    $message = $_REQUEST['msg'];

    mail('me@whatever.com', $message,$name);

    ?>

    i have also downloaded a SMTP piece of software to try and overcome the problem but no result yet ... Thnaks for all your help :P

    A 1 Reply Last reply
    0
    • S SRJ92

      hello , i have been trying to sort this out for hours , and there are probably 2000 other people who have asked this but when i try and send form results to an email adress from the local host which i set up i get this : Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Apache2.2\htdocs\websites\test\process.php on line 6 here is my code in php.ini

      [mail function]
      STMP = localhost
      sendmail_from = me@whatever.com

      here is my code in the form process.php

      <?php

      $name = $_REQUEST['name'];
      $message = $_REQUEST['msg'];

      mail('me@whatever.com', $message,$name);

      ?>

      i have also downloaded a SMTP piece of software to try and overcome the problem but no result yet ... Thnaks for all your help :P

      A Offline
      A Offline
      Adam Maras
      wrote on last edited by
      #2

      You need to add a custom header as a fourth parameter to the mail function, to add your From header. Example:

      mail('me@whatever.com', $message, $name, 'From: webmaster@example.com' . "\r\n");

      Adam Maras | Software Developer Microsoft Certified Professional Developer

      S 1 Reply Last reply
      0
      • A Adam Maras

        You need to add a custom header as a fourth parameter to the mail function, to add your From header. Example:

        mail('me@whatever.com', $message, $name, 'From: webmaster@example.com' . "\r\n");

        Adam Maras | Software Developer Microsoft Certified Professional Developer

        S Offline
        S Offline
        SRJ92
        wrote on last edited by
        #3

        Thanks that worked perfectly , by any chance do you know how i can fix this error ?

        It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting
        or the date_default_timezone_set() function. In case you used any of those methods and you are still

        getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/London' for '0.0/no DST'
        instead in C:\Apache2.2\htdocs\websites\test\process.php on line 6

        Thanks again

        F 1 Reply Last reply
        0
        • S SRJ92

          Thanks that worked perfectly , by any chance do you know how i can fix this error ?

          It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting
          or the date_default_timezone_set() function. In case you used any of those methods and you are still

          getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/London' for '0.0/no DST'
          instead in C:\Apache2.2\htdocs\websites\test\process.php on line 6

          Thanks again

          F Offline
          F Offline
          fly904
          wrote on last edited by
          #4

          You shouldn't rely on the default timezone of the server. It needs to be explicitly set to the required timezone. Eg:

          date_default_timezone_set( 'Europe/London' ); // Or the timezone of your choice.

          So put that line before line 6, process.php.

          If at first you don't succeed, you're not Chuck Norris.

          S 1 Reply Last reply
          0
          • F fly904

            You shouldn't rely on the default timezone of the server. It needs to be explicitly set to the required timezone. Eg:

            date_default_timezone_set( 'Europe/London' ); // Or the timezone of your choice.

            So put that line before line 6, process.php.

            If at first you don't succeed, you're not Chuck Norris.

            S Offline
            S Offline
            SRJ92
            wrote on last edited by
            #5

            Thanks !!! :D

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups