Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

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

Status
Not open for further replies.

way2many

Technical User
Nov 28, 2003
139
US
Hi,
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)

error:

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:

<?php

$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;";

mail($email,$subject,$body,$mail_hdr)

?>
 
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.
 
WoodyRoundUp,

You just got a STAR!
It works!

Many thanks!
 
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?
 
Yes.
Place this on top of your page.

ini_set ("SMTP","mail.MyWebSite.com");
ini_set ("sendmail_from","webmaster@MyWebSite.com");
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top