473,573 Members | 2,268 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What Else Do I Need?

I am just learning PHP. I just tried coding a php script which I saved
as

mail.php

----------------------------
<?
$name=$_POST['name'];
$email=$_POST['email'];
$comments=$_POS T['comments'];
$to="pr******@u png.ac.pg";
$message="$name just filled in your comments form. They
said:\n$comment s\n\nTheir e-mail address was: $email";
if(mail($to,"Co mments From Your Site",$message, "From: $email\n")) {
echo "Thanks for your comments.";
} else {
echo "There was a problem sending the mail. Please check that you
filled in the form correctly.";
}
?>
--------------------------------------------------
and a simple html file called

mailProcess.htm l
----------------------------------------------
<html>
<head>
<title></title>
</head>

<body>
<h2>Sending Mail using PHP scripting...</h2>
<form action="../mail.php" method="post">
Your Name: <input type="text" name="name"><br >
E-mail: <input type="text" name = "email"><br><br >
Comments<br>
<textarea name="comments" ></textarea><br><b r>
<input type="submit" value="Submit">
</form>
</body>
</html>
----------------------------------------------------
which captured data from the user intended for
mail.php
script to process and eventually send an email message to the person
while at the same time display a Thankyou page.

The script is working fine but the question is how do I get the IF part
of the CONDITIONAL statement executed rather than the ELSE part.
Currently it is the ELSE part of the CONDITIONAL statement is being
executed despite me supplying valid email address.

What could be the problem? Should I have installed SEND::Mail or things
like that? I already have PHP 5 and Apache 2 installed on my PC which
runs Windows XP.

jofio

Jul 17 '05 #1
9 1889
*** Jofio wrote/escribió (1 Jun 2005 00:24:04 -0700):
What could be the problem? Should I have installed SEND::Mail or things
like that? I already have PHP 5 and Apache 2 installed on my PC which
runs Windows XP.


Under Windows, you need to configure an external SMTP server that accepts
mail from you; check php.ini for the details. If your ISP's mail server
doesn't accept your mail, then you need to install a local one. Windows XP
Professional includes a mail server (check the "Add/Remove programs" icon).

--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Jul 17 '05 #2
..... Windows XP
Professional includes a mail server (check the "Add/Remove programs"
icon). .....
What could be the mail server's name ....I just checked and nothing
there listed appeared to be one.....
jofio

Jul 17 '05 #3
mail "Returns TRUE if the mail was successfully accepted for delivery,
FALSE otherwise".
it seems your mail is not accepted for delivery. this could be the
sendmail setting.

try to send some testmail first to yourself and turn on error reporting
to find out what actually happens.

2nd thing i noticed: you're using values from the $_POST array
unvalidated. that's ok for just trying on your pc, but should never be
done otherwise. best not to get used to it.

micha

Jul 17 '05 #4
*** Jofio wrote/escribió (1 Jun 2005 01:28:25 -0700):
.... Windows XP
Professional includes a mail server (check the "Add/Remove programs"
icon). .....

What could be the mail server's name ....I just checked and nothing
there listed appeared to be one.....


Translating from Spanish:

Add or remove Windows components->
Internet Information Server services (IIS)->
SMTP Service

Please note Home Edition does not include this program.
In any case, I'd first try your ISP's mail server. Just make sure you add a
valid "From" address. However, if your ISP requires SMTP authentication,
you cannot use mail(), you'd need an alternative.

--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Jul 17 '05 #5
Micha,

I figured out Ithat don't have a mail server on my PC (I am using my
PC as my development platform) which I have to refer to in the mail
section of the php.ini ...To be honest I have no experience whatsoever
in setting things in php.ini file. I might have to look around for
help.

jofio

Jul 17 '05 #6
Alvaro,

The Web server I am using is Apache 2 and PHP 5. I don't exactly know
if an email server that comes with IIS can be set up in the php.ini
file to work with Apache Web Server.

jofio

Jul 17 '05 #7
*** Jofio wrote/escribió (1 Jun 2005 03:13:54 -0700):
The Web server I am using is Apache 2 and PHP 5. I don't exactly know
if an email server that comes with IIS can be set up in the php.ini
file to work with Apache Web Server.


Mail server does not need to interact with Apache at all, it's PHP the one
who will deliver messages to mail server using port 25. PHP doesn't care
whether the mail server is local or remote.

In php.ini:

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

; For Win32 only.
sendmail_from = yo**@email.address
Have you actually tried using the same mail server you use to send your
regular mail?
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Jul 17 '05 #8
Brother, you're correct in that I must try using the same mail server
that I use for regular mail. that will have to be the next thing I'll
try and do, but I'll have to gather the guts to ask our IT
director/administrator to tell me the path to the mail server (LOL).

However, all this time I was trying to get emails send off straight
from my PC to whoever. But the problem was my own stupidity in that
that I was all the time thinking that PHP doesn't need a mail server
for that purpose.

In the absence of a PC based mail server, I simply have no choice but
have to get in touch with the IT administrator and get mail server path
info.

Many thanks, brother

jofio

Jul 17 '05 #9
You do NOT need to set up a mail server on your computer, that's an
unnecessary complication. No ISP will refuse to send your outgoing mail!

Instead, you need to make sure that your mail headers are correctly formed
so that your ISP (or the recipient's) does not block your mail as SPAM. This
will occur if the "envelope from" address is different from the "from"
address. So you need two parameters that contain your from address in the
call to mail(), one plain address and one header. Check the PHP
documentation for details on how to set the mail headers.

ECRIA
http://www.ecria.com
Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
6864
by: lkrubner | last post by:
I want to give users the power to edit files from an easy interface, so I create a form and a PHP script called "fileUpdate". It does a reasonable about of error checking and prints out some errors. It uses fileperms() to get the permissions of the file, and it includes that info in any error message. Today I'm getting the following error...
92
6386
by: Reed L. O'Brien | last post by:
I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike but with better encryption? cheers, reed
125
14608
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from software giant such as Microsoft SQL Server, Oracle, and Sybase? Is PostgreSQL reliable enough to be used for high-end commercial application? Thanks
121
9978
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode support IDEs are DreamWeaver 8 and Zend PHP Studio. DreamWeaver provides full support for Unicode. However, DreamWeaver is a web editor rather...
8
12975
by: werner | last post by:
Hi! I don't want to use eval() in order to parse a user-supplied formula. What alternatives do I have? PHP has no standard functionality for tokenizing or parsing expressions in this regard. Here is a simple example: The user supplies the following formula in string format, "a = (6+10)/4", and the script needs to find out what the value...
669
25703
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic paper written on this subject. On the Expressive Power of Programming Languages, by Matthias Felleisen, 1990....
53
3145
by: jaso | last post by:
Can you give any comments on this code? I used one goto, is it bad? #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> #include <assert.h> #define NOT_NULL 1
13
520
by: Protoman | last post by:
I'm getting an error: 10 C:\Dev-Cpp\Enigma.cpp no match for 'operator<' in 'i < (+cleartext)->std::basic_string<_CharT, _Traits, _Alloc>::end ()' Code: Enigma.hpp -------------------------- #pragma once
3
1965
by: bb nicole | last post by:
I have did the company login and job post which means that company can post the job after they login in my webpage.. I had set company_ID(tablename:company) is foreign key of table job. But when i post the job into database, the company_ID show 0(which means when company register, the company_ID should be 2, for example, but in table job, it show...
11
1556
by: James R. Davis | last post by:
Yes, a newbie here. Though I am making progress, slowly, I am also getting more and more confused. With ASP, when I wanted to do something as trivial as updating a visitor counter, I connected to a database, executed a SQL command to read the current value of a field into a recordset, updated the value by adding 1 and writing the field...
0
7709
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8039
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8218
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7800
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5296
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3738
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3744
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1330
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1049
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.