473,804 Members | 2,154 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 1901
*** 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
6921
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 message. I've used SmartFtp to go in and set the test file's permissions to 777, but in this error...
92
6553
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
14874
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
10198
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 than a PHP IDE. It only supports basic IntelliSense (or code completion) and doesn't have anything...
8
13065
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 of 'a' is.
669
26274
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. http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expressive-slides.pdf
53
3198
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
1972
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 0). What should i do or what php code should i add to get the correct company_ID in table job. And...
11
1577
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 back to the table, closed and got rid of the connection and recordset. I had no concerns about how...
0
9712
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10595
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10341
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10089
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7634
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5530
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3001
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.