Re: Configuring PHP.ini file to use PHP mail Funtion on IIS 5.0 server



simple answer...open port 25 on your server, type in the rfc email commands
to send an email to a valid email account. note any errors that occur. see
if you receive said email.

if that works, then i'd say iis smtp is setup. if not...rtfm for iis smtp
configuration.

next, i would avoid using the mail function for iis like the plague! just
give your pick up directory writeable access to your IUSR_<computer name
here> account...and use php to write a valid email directly to file in that
directory. smtp will send it from there. you should know from sending an
email on port 25 (because you actually read the smtp rfc) what information
and format constitues a "valid" email. you could use the com function to
instanciate a cdonts object and send the email that way...but why!

it's a bitch to have a reasonably secure smtp server and still be able to
use the mail function successfully...hell, even if it's totally insecure
it's still a bitch.

and for GAWD'S SAKE, the FIRST thing you need to do is to NOT allow relaying
on your smtp server...don't be subject to spammer hijacking. you'll get your
server/ip blocked world-wide *and* your isp could drop you as a
customer...even if you are NOT the one originating the spam.

hth,

steve


<caroline_harris@xxxxxxxxxxx> wrote in message
news:1120339478.288114.218370@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
| Hello:
|
| I am new to the PHP world. I would like to utilize the Mail function
| within PHP, however, I cannot seem to get a simple mail form to work.
| My configuration is listed below:
|
| I have Installed:
|
| 1. PHP 5 - I have tested basic commands such as:
|
| <?php
|
| $cnt=0;
| while($cnt <= 10)
| {
| $cnt++;
| echo "Hello World<P>";
| }
| ?>
|
| and it is working fine.
|
| 2. Operating System - Windows 2K
|
| 3. Web Server - IIS 5.0
|
| 4. Built in Virtual SMTP Server
|
|
| ============
|
| Goal:
|
| To test web-based email applications locally on my system for
| development purposes.
|
| Problem:
|
| I do not know if my mail configuration settings within my php.ini file
| are correct. I currently have:
|
| [mail function]
| ; For Win32 only.
| SMTP = localhost ; for Win32 only
| smtp_port = 25
| sendmail_from= (my email address - it is hotmail account) ; for Win32
| only
|
| I also have no idea if I have properly configured IIS and the virtual
| SMTP server correctly. I do not know what my server address would be. I
| do not have a registered domain name, etc. Localhost is the only server
| address I am familiar with when testing locally. In addition, it is
| possible that sending emails to my hotmail account may be blocked. I do
| not know where the basic application is failing, so it is difficult to
| know where to begin.
|
|
| This is the code that I am using for the form:
|
| HTML Form:
|
| !CODE BEGINS!
|
|
| <h1> Email Form</h1>
|
| <form method="post" action="cont.php">
| Fields marked (*) must be filled in.
| <p>
| Your email address*
| <br>
| <input type="text" name="EmailFrom" size="60">
| <p>
| Your name
| <br>
| <input type="text" name="Name" size="60">
| <p>
| Subject
| <br>
| <input type="text" name="Subject" size="60">
| <p>
| Message*
| <br>
| <textarea name="Message" rows="15" cols="65"></textarea>
| <p>
| <input type="submit" name="submit" value="Submit">
| </form>
|
| !CODE ENDS!
|
| >>>>>This is the PHP driving the form
|
| !CODE BEGINS !
|
| <?php
|
| // get posted data into local variables
| $EmailFrom = Trim($_POST[EmailFrom]);
| $EmailTo = "John Doe <myemail@xxxxxxxxxxx>";
| $Subject = Trim($_POST[Subject]);
| $Name = Trim($_POST[Name]);
| $Message = Trim($_POST[Message]);
|
| // validation
| $validationOK=true;
| if (Trim($EmailFrom)=="") $validationOK=false;
| if (Trim($Message)=="") $validationOK=false;
| if (!$validationOK) {
| print "<meta http-equiv=\"refresh\" content=\"0;URL=no.htm\">";
| exit;}
|
| // prepare email body text
| // tells you that the mail is sent from this form
| $Body .= "Message sent from email form:\n";
| $Body .= "$Message";
|
| // send email
| $success = mail($EmailTo, $Subject, $Body, "From: $Name <$EmailFrom>");
|
| // redirect to success page
| if ($success){print "<meta http-equiv=\"refresh\"
| content=\"0;URL=yes.htm\">";}
| else{print "<meta http-equiv=\"refresh\" content=\"0;URL=no.htm\">";}
|
| // send copy of email to visitor
| mail("$Name <$EmailFrom>", "John Doe has received your message
| '$Subject'",
| "You wrote: $Message", "From: John Doe <myemail@xxxxxxxxxxx>");
| ?>
|
| !CODE ENDS!
|
|
| So far the application routes me to the no.htm page. I would appreciate
| any suggestions! Thanks.
|


.



Relevant Pages

  • Re: Outlook Express error when sending email
    ... >> with McAfee Antivirus and Firewall disabled. ... >> Looking on MS's Knowledge Base, the error means "0x800CCC0B BUSY Server ... >> The SMTP server was definitely correct - it was the same ISP and same ... > make a clean installation. ...
    (uk.comp.misc)
  • Re: 554 : Recipient address rejected: Relay acces
    ... What I expect is that telus will only, by default, let people use their SMTP server to relay email when they are connecting via the telus network on a telus IP address ...
    (microsoft.public.exchange.admin)
  • Suddenly mails sent by IIS stop being delivered to hotmail accounts
    ... I've a really big problem sending mails to hotmail accounts. ... Now there's no way to get mail sent by our Virtual SMTP server being ... We are on Windows Server 2003, ...
    (microsoft.public.inetserver.iis.smtp_nntp)
  • Re: email forms fail with FronPage Error please report details to webmaster
    ... Check if SMTP server settings are correctly configured. ... address specified in the form configuration (Sometimes the Relay might not ... Right click on the Default SMTP Virtual Server and select Properties. ...
    (microsoft.public.frontpage.extensions.windowsnt)
  • Re: Using two different smtp servers
    ... Does your campus support authenticated SMTP? ... your campus' SMTP server as an outgoing server for both accounts? ... through their own SMTP server, so that blocks access to our campus SMTP ...
    (microsoft.public.mac.office.entourage)