Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


mail() function - "sendmail_from" not set in php.ini

mail() function - "sendmail_from" not set in php.ini

mail() function - "sendmail_from" not set in php.ini

I need to use mail() function on several PHP pages.
(we are renting web space on win2000 server and have access through H-Sphere control panel)


Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing

I put a copy of php.ini in the root of my website as someone from tech support suggested some time ago.

here is what it looks like in php.ini after my changes:
[mail function]
; For Win32 only.
SMTP = mail.MyWebSite.com ; for Win32 only
;smtp_port = 25
sendmail_from= webmaster@MyWebSite.com ; for Win32 only
still getting the same error...

Is php.ini in the wrong place or something else is not correct?

thank you
test file w/php mail function:


$email = "mytest@mytest.com"; # email address of recipient
$subject = "This is a test email"; # subject of email
$body = "This is where the text goes...";
$mail_hrd = "From: webmaster@MyWebSite.com &lt;webmaster@MyWebSite.com;";



RE: mail() function - "sendmail_from" not set in php.ini

I think it's because you are sharing the server, and your php.ini is not read by PHP.

You can try this:
ini_set ("SMTP","mail.MyWebSite.com");
ini_set ("sendmail_from","webmaster@MyWebSite.com");

put them on top of your page, in the PHP tag. See whether it makes any different.

RE: mail() function - "sendmail_from" not set in php.ini


You just got a STAR!
It works!

Many thanks!

RE: mail() function - "sendmail_from" not set in php.ini


My first day here as a solution provider, I got a star.


RE: mail() function - "sendmail_from" not set in php.ini

Question:  I am running a mb that works off phpbb.  I am having a similar problem. sendmail_from has no calue and the sendmail_path is showing the default. I know how to fix the issue but, unfortunately, my server host doesn't give me access to my php.ini file.

Would this workaround work in this situation? If so, where do I need to place it?

RE: mail() function - "sendmail_from" not set in php.ini

Place this on top of your page.

ini_set ("SMTP","mail.MyWebSite.com");
ini_set ("sendmail_from","webmaster@MyWebSite.com");

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close