Connecting Tech Pros Worldwide Forums | Help | Site Map

sending mail in php

Newbie
 
Join Date: Nov 2006
Posts: 3
#1: Nov 8 '06
i want to send an automatic mail .how to tht in a php script.i can use mail() fuction but it is not working.what type configuration i should do.please tell

Newbie
 
Join Date: Nov 2006
Posts: 25
#2: Nov 8 '06

re: sending mail in php


[php]$to = "bilkirim@yahoo.gr";
$subject = "Hello Bill";
$body = "type your text here";
if (mail($to, $subject, $body))
{
echo("<p>Message successfully sent!</p>");
}
else
{
echo("<p>Message delivery failed...</p>");
}
[/php]
You have to make some changes to your php.ini file..
[mail function]
; For Win32 only.
SMTP = your_mail_domain
smtp_port = 25

; For Win32 only.
sendmail_from = bilkirim@themusicase.com //yout mail

i have my own mail domain.. i don't think that it works with yahoo,hotmail mails but i am not sure.
Newbie
 
Join Date: Nov 2006
Posts: 23
#3: Nov 8 '06

re: sending mail in php


I am having the same problem, but i am using unix sendmail program and the mail server is exim 3.36.
Could you help with php mail() program?
Thanks
Newbie
 
Join Date: Nov 2006
Posts: 25
#4: Nov 8 '06

re: sending mail in php


Quote:

Originally Posted by glady

I am having the same problem, but i am using unix sendmail program and the mail server is exim 3.36.
Could you help with php mail() program?
Thanks

i think it is the same code..
the only differense is in the php.ini file.
you have to add this line
sendmail_path = (your sendmail path)
Newbie
 
Join Date: Nov 2006
Posts: 25
#5: Nov 8 '06

re: sending mail in php


sorry i forgot.. You have to restart your server to apply the changes..

If it is apache.
c:\(apache path)\apache -k restart
Newbie
 
Join Date: Nov 2006
Posts: 23
#6: Nov 8 '06

re: sending mail in php


Quote:

Originally Posted by billkirim

sorry i forgot.. You have to restart your server to apply the changes..

If it is apache.
c:\(apache path)\apache -k restart

Do i need to give in command line,
do i need to go to shell prompt and give the path of php.ini file and restart?
like.....
myusername@sandbox:~\etc\php4\apache\php.ini -k restart
Thanks
Newbie
 
Join Date: Nov 2006
Posts: 25
#7: Nov 8 '06

re: sending mail in php


Quote:

Originally Posted by glady

Do i need to give in command line,
do i need to go to shell prompt and give the path of php.ini file and restart?
like.....
myusername@sandbox:~\etc\php4\apache\php.ini -k restart
Thanks

No Apache look automatic for Your Php.ini File..
It is Stored to Your System Direcory.
The only thing you have to do is.
to go to your apache folder (where you biuld apache)
if you don't know search for the Apache.exe file
it mostly be in a \bin\ directory
and then
myusername@sandbox:~\etc\www\apache\bin\apache -k restart
Newbie
 
Join Date: Nov 2006
Posts: 23
#8: Nov 8 '06

re: sending mail in php


Quote:

Originally Posted by billkirim

No Apache look automatic for Your Php.ini File..
It is Stored to Your System Direcory.
The only thing you have to do is.
to go to your apache folder (where you biuld apache)
if you don't know search for the Apache.exe file
it mostly be in a \bin\ directory
and then
myusername@sandbox:~\etc\www\apache\bin\apache -k restart

I found the path of the server and restarted the server, but still it doesnt work.
Will the problem be in the
sendmail_path=
do i need to give explicitly the path or will it take the default value?
the default value is "sendmail -t -i"
Is it possible to open and read sendmail program?
Reply