469,647 Members | 1,778 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,647 developers. It's quick & easy.

Using mail()

I am trying to use the mail() function in my PHP script, but when I run the
script, nothing happens. I am using Windows XP with Apache. I have the
current versions of PHP 4, Apache 2, and MySQL.

I think I might have to make a configuration in my php.ini file to point to
the sendmail program or something. I don't know how to do that. Does
anybody think they can help me with this?

I want to be able to write a page that has a form, and then when the person
fills the form and submits it, it gets emailed to me.
Nick
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>

<base target="right">
<title>Comment</title>
</head>

<body>

<?php

$comment = $_POST['comment'];

$email = $_POST['email'];

$toaddress = 'm*****@operamail.com';
$subject = 'Cool';
$mailcontent = $comment;
$fromaddress ='From: ma******@hotmail.com';

mail($toaddress, $subject, $mailcontent);
?>
</body>
</html>
Jul 17 '05 #1
4 1775

"Nick Mudge" <ma******@hotmail.com> wrote in message
news:LyHkc.2234$Ia6.285084@attbi_s03...
I am trying to use the mail() function in my PHP script, but when I run the script, nothing happens. I am using Windows XP with Apache. I have the
current versions of PHP 4, Apache 2, and MySQL.

I think I might have to make a configuration in my php.ini file to point to the sendmail program or something. I don't know how to do that. Does
anybody think they can help me with this?


In PHP.INI:

[mail function]
; For Win32 only.
SMTP = localhost

; For Win32 only.
sendmail_from = me@localhost.com

; For Unix only. You may supply arguments as well (default:
'sendmail -t -i').
;sendmail_path =

HTH
Garp
Jul 17 '05 #2
My php.ini is set up that way, and it still doesn't work, does anybody have
any suggestions?
"Garp" <ga***@no7.blueyonder.co.uk> wrote in message
news:G2*********************@news-text.cableinet.net...

"Nick Mudge" <ma******@hotmail.com> wrote in message
news:LyHkc.2234$Ia6.285084@attbi_s03...
I am trying to use the mail() function in my PHP script, but when I run

the
script, nothing happens. I am using Windows XP with Apache. I have the
current versions of PHP 4, Apache 2, and MySQL.

I think I might have to make a configuration in my php.ini file to point

to
the sendmail program or something. I don't know how to do that. Does
anybody think they can help me with this?


In PHP.INI:

[mail function]
; For Win32 only.
SMTP = localhost

; For Win32 only.
sendmail_from = me@localhost.com

; For Unix only. You may supply arguments as well (default:
'sendmail -t -i').
;sendmail_path =

HTH
Garp

Jul 17 '05 #3
Nick Mudge top-posted [corrected]:
"Garp" <ga***@no7.blueyonder.co.uk> wrote in message
news:G2*********************@news-text.cableinet.net...
In PHP.INI:

[mail function]
; For Win32 only.
SMTP = localhost

; For Win32 only.
sendmail_from = me@localhost.com
My php.ini is set up that way, and it still doesn't work, does anybody have
any suggestions?


[mail function]
SMTP = mx3.hotmail.com
sendmail_from = ma******@hotmail.com
But I believe hotmail does not allow you to use its SMTP service.
Configure the SMTP server to the same server you have for your mail
program and use the sender as your address there.

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #4
Thanks a lot.

SMTP = mx3.hotmail.com
sendmail_from = ma******@hotmail.com

Worked.

"Pedro Graca" <he****@hotpop.com> wrote in message
news:c7************@ID-203069.news.uni-berlin.de...
Nick Mudge top-posted [corrected]:
"Garp" <ga***@no7.blueyonder.co.uk> wrote in message
news:G2*********************@news-text.cableinet.net...
In PHP.INI:

[mail function]
; For Win32 only.
SMTP = localhost

; For Win32 only.
sendmail_from = me@localhost.com
My php.ini is set up that way, and it still doesn't work, does anybody

have any suggestions?


[mail function]
SMTP = mx3.hotmail.com
sendmail_from = ma******@hotmail.com
But I believe hotmail does not allow you to use its SMTP service.
Configure the SMTP server to the same server you have for your mail
program and use the sender as your address there.

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :

Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by PeterR | last post: by
4 posts views Thread by =?Utf-8?B?dHBhcmtzNjk=?= | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.