mail function is not sending mail in php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dinesh1985singh
    New Member
    • Apr 2010
    • 49

    mail function is not sending mail in php

    Hi all,

    I am using php mail function to send simple mail , but the mail function is giving me the error following error :

    Warning: mail() [function.mail]: "sendmail_f rom" not set in php.ini or custom "From:" header missing in D:\Inetpub\head trixtraining\re gister.php on line 4234
    mail not send

    when I tried to see the mail setting by phpinfo() function I get the following values for different mail parameters:

    1) sendmail_from no value no value
    2) sendmail_path no value no value
    3) SMTP localhost localhost

    I am using the following code for that :

    $headers = 'From: Headtrix Team <info@headtrixt raining.com>'." \n";
    mail('dinesh198 5singh@gmail.co m','test subject','test message',$heade rs);

    Could you please explain how to get rid of this error message.

    Thanks
  • Dipen Mehta
    New Member
    • Jun 2011
    • 16

    #2
    php can not send mail directly but it requires send mail library files and set the configuration into that file and than use mail() in PHP.

    For more Reference see : http://www.youtube.com/watch?v=Obo5d8nQxkU

    Comment

    • dinesh1985singh
      New Member
      • Apr 2010
      • 49

      #3
      Thanks Dipen,

      Its not my answer,we need to set these variables in php.ini or in a file on which we are going to using mail() function by ini_set() function like:

      ini_set("SMTP", "mail.abc.com") ;
      ini_set("smtp_p ort","25");
      ini_set('sendma il_from', 'info@abc.com') ;

      Just these few lines of code done my job.
      Anyways I get to know new thing from the link you suggested.

      Thanks

      Comment

      Working...