473,396 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1929

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: PeterR | last post by:
I've spent weeks trying to write a function that is simple to use for sending emails with attachments, but I my programming skills are not that advanced. I've noticed a few postings in these...
1
by: Irmen de Jong | last post by:
Hi I'm trying to create e-mail content using the email.MIMEText module. It basically works, until I tried to send mail in non-ascii format. What I did, to test both iso-8859-15 and UTF-8...
1
by: Eric Sheu | last post by:
Greetings, I have been searching the web like mad for a solution to my SMTP problem. I am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a web site I have created to...
2
by: Ryan | last post by:
Hi, I receive an access denied error (see below) when attempting to send an email with BodyFormat=MailFormat.Html from an asp.net page. Exactly the same code works fine in a console...
2
by: Brad | last post by:
I have a web .Net app which sends emails with attachments. After the email is sent I clean up aftermyself and delete the attachments from disk. In upgrading to .Net 2 I changed the email logic...
2
by: Abhi | last post by:
i need to create a user in web mail using dotnet coad by using webmailserver api ex: xxx is my webmail then i want to create to a user in that webmail xxx ex: yyy@xxx.com how i should do in...
1
by: Prasanta | last post by:
Hello, How to read a mail from the mail server as formatted. I am able to read the mail as row HTML, is there any class, or something method using that i can easily get the all info of that...
4
by: =?Utf-8?B?dHBhcmtzNjk=?= | last post by:
I have a web page that at the click of a button must send a bunch (1000+) emails. Each email is sent individually. I have the code working fine, using Mail Message classes and smtp and all that. ...
4
by: Ron | last post by:
I have this code on one of my forms, the code takes whatever is in textboxes and adds it to a MS Access Database. It then shows a message that the operation was completed. Is there a universal...
4
Frinavale
by: Frinavale | last post by:
Introduction Many .NET applications will require an email be sent out for various reasons. This article will give a quick examples on how to send an email using VB.NET. The examples given can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.