Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Web Design & Development Web Design & Development
Search Search
Search for:
Tech Support Guy > > >

Solved: php: sending an e-mail from a web browser application


(!)

andynic's Avatar
andynic andynic is offline   andynic has a birthday soon!
Computer Specs
Member with 233 posts.
THREAD STARTER
 
Join Date: May 2007
Location: Amsterdam
Experience: Beginner
16-Jul-2012, 07:44 AM #1
Solved: php: sending an e-mail from a web browser application
Hi,

I'm trying to get this test script working:
<?php
$to = "a valid email address";
$subj = "Test mail";
$msg = "Hello! This is a simple email message.";
$hdr = "From: test script";
$rslt = mail($to, $subj, $msg, $hdr);
echo "rslt = $rslt<br />";
?>

If, for "a valid email address", I use my yahoo.com address, I receive the email.
If, on the other hand, I use my xs4all.nl address (my regular email), no mail arrives, neither in my inbox nor in the spambox.

The settings in the server's php.ini file are:
[mail function]
; For Win32 only.
; http://php.net/smtp
;SMTP = localhost
SMTP = smtp.xs4all.nl
; http://php.net/smtp-port
smtp_port = 25

According to the xs4all tech desk website, these are the required settings:
Instellingen e-mail via POP (instellingen = settings)
Inkomende mailserver pop.xs4all.nl (poort 110) (inkomende = incoming)
Uitgaande mailserver smtp.xs4all.nl (poort 25) (uitgaande = outgoing)

Any idea why the application won't send the email to my xs4all address?

Thanks for you help.
Andynic
allnodcoms's Avatar
allnodcoms   (Danny) allnodcoms is offline allnodcoms has a Profile Picture
Computer Specs
Member with 610 posts.
 
Join Date: Jun 2007
Location: Hertfordshire - England
Experience: Advanced
16-Jul-2012, 03:32 PM #2
First off Andy, do you get "rslt = true" on both addresses? If you do I would suggest that it may be a server issue.

Some Windows servers can get cross if "From:" is not a valid address, as they use it for ReplyTo (which has to be valid if present). I'd give that a go, and I'd also try setting the SMTP server back to localhost and see if that has any effect.

Other than that it all looks OK.

Danny
andynic's Avatar
andynic andynic is offline   andynic has a birthday soon!
Computer Specs
Member with 233 posts.
THREAD STARTER
 
Join Date: May 2007
Location: Amsterdam
Experience: Beginner
17-Jul-2012, 03:56 AM #3
Thanks for your reply, Danny.
The rslt is "true" whether the code is as shown above or as revised below.
I changed the command adding the -f parameter which I found under "additional parameters" on the php.net website in the mail function doc.
$f = "-f $to";
$rslt = mail($to, $subj, $msg, $hdr, $f);
That works both with the php.ini SMTP parameter set to either localhost or as shown above. So I have left it as localhost.
Andynic
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


Tags
email, php

(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑