How to fix error with mail function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deiv82
    New Member
    • Jul 2010
    • 10

    #1

    How to fix error with mail function

    Hello everybody,
    I'm trying to send the informations from the web form of my site to my email.

    The problem is that I always get this kind of error:

    PHP Warning: mail() [function.mail]: "sendmail_f rom" not set in php.ini or custom "From:" header missing in D:\Home\wwwroot \form\invioform .php on line 12

    Somebody can tell me what exactly means this error?

    Thank you very much
  • JKing
    Recognized Expert Top Contributor
    • Jun 2007
    • 1206

    #2
    You need to let the function know who the mail is coming from. Either by setting a From header or modifying your php.ini file.

    Straight from the php.net website:
    Note:

    When sending mail, the mail must contain a From header. This can be set with the additional_head ers parameter, or a default can be set in php.ini.

    Failing to do this will result in an error message similar to Warning: mail(): "sendmail_f rom" not set in php.ini or custom "From:" header missing. The From header sets also Return-Path under Windows.
    Have a read over this and it should explain everything. PHP Mail Function

    Comment

    • mfaisalwarraich
      New Member
      • Oct 2007
      • 194

      #3
      are you trying to send it through http://localhost?

      Comment

      Working...