Welcome to Dream.In.Code
Become a PHP Expert!

Join 150,172 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 2,257 people online right now. Registration is fast and FREE... Join Now!




sendmail issue

 
Reply to this topicStart new topic

sendmail issue

geethalakshmi
27 Aug, 2008 - 03:34 AM
Post #1

New D.I.C Head
*

Joined: 9 Apr, 2008
Posts: 13

Hi,

When i tried to send mail from localhost, i received an error stating it:

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

But it works in the server.

Pls help!

Regards,
geetha
Free programming tutorials
User is offlineProfile CardPM
+Quote Post

dineeshd
RE: Sendmail Issue
27 Aug, 2008 - 03:39 AM
Post #2

D.I.C Addict
Group Icon

Joined: 30 Jun, 2008
Posts: 579



Thanked: 16 times
Dream Kudos: 575
My Contributions
Please post the code you have so far..... rolleyes.gif
User is offlineProfile CardPM
+Quote Post

JackOfAllTrades
RE: Sendmail Issue
27 Aug, 2008 - 10:54 AM
Post #3

Cantankerous Old Fart
Group Icon

Joined: 23 Aug, 2008
Posts: 862



Thanked: 89 times
Dream Kudos: 50
My Contributions
Perhaps Reading The Fine Manual would be helpful? Pay particular attention to the additional_headers optional argument and its explanation.
User is offlineProfile CardPM
+Quote Post

jonesa01
RE: Sendmail Issue
29 Aug, 2008 - 05:25 AM
Post #4

New D.I.C Head
Group Icon

Joined: 18 Feb, 2007
Posts: 39


Dream Kudos: 25
My Contributions
Well just to lend a hand, here is the basic code for a mail

CODE

$to = "someone@someone.com";
$from = "Someone <someone@somewhere.com>";
$subject = "Subject";
$message = "Message";
$header = "From: ".$from;

if(mail($to,$subject,$message,$header)){
echo "Mail sent";
}else{
echo "Error sending mail";
}

User is offlineProfile CardPM
+Quote Post

CTphpnwb
RE: Sendmail Issue
29 Aug, 2008 - 06:16 AM
Post #5

D.I.C Regular
Group Icon

Joined: 8 Aug, 2008
Posts: 481



Thanked: 32 times
My Contributions
QUOTE(jonesa01 @ 29 Aug, 2008 - 06:25 AM) *

Well just to lend a hand, here is the basic code for a mail

CODE

$to = "someone@someone.com";
$from = "Someone <someone@somewhere.com>";
$subject = "Subject";
$message = "Message";
$header = "From: ".$from;

if(mail($to,$subject,$message,$header)){
echo "Mail sent";
}else{
echo "Error sending mail";
}


Is there some setting I'm missing in the php setup? This script tells me that mail has been sent, but it never gets to the address I use (mine).

User is offlineProfile CardPM
+Quote Post

jonesa01
RE: Sendmail Issue
29 Aug, 2008 - 06:44 AM
Post #6

New D.I.C Head
Group Icon

Joined: 18 Feb, 2007
Posts: 39


Dream Kudos: 25
My Contributions
Well I think so, but from past experience, some hosts require the e-mail from to be of the domain used.

So if you had example.com

The e-mail must look something like this:

CODE

$to = "someone@yahoo.com";
$from = "someone@example.com";
$subject = "Subject";
$message = "Message";
$header = "From: ".$from;

if(mail($to,$subject,$message,$header)){
echo "Mail sent";
}else{
echo "Error sending mail";
}


If you can edit php_config you probably can fix this issue.
User is offlineProfile CardPM
+Quote Post

CTphpnwb
RE: Sendmail Issue
29 Aug, 2008 - 07:30 AM
Post #7

D.I.C Regular
Group Icon

Joined: 8 Aug, 2008
Posts: 481



Thanked: 32 times
My Contributions
Hmm...
It seems to be a problem with my sendmail setup, not php. sad.gif
User is offlineProfile CardPM
+Quote Post

jonesa01
RE: Sendmail Issue
29 Aug, 2008 - 07:40 AM
Post #8

New D.I.C Head
Group Icon

Joined: 18 Feb, 2007
Posts: 39


Dream Kudos: 25
My Contributions
I do not know what to suggest then
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 03:20AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month