PHP Email Not working Properly

mail function sends to web based email but not smtp/pop based email

Page 1 of 1

3 Replies - 1040 Views - Last Post: 09 September 2009 - 01:13 PM Rate Topic: -----

#1 macbot  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 22-April 09

PHP Email Not working Properly

Posted 09 September 2009 - 10:40 AM

i have a registration form on my website which sends an email to the person with a temporary password

this is the code for the form
<form method=post action=authpage.php name=registerform onsubmit="return validate_register ( );">
<table class="m1_text">
<tr><td align=right>RefNo:</td><td><input type=text name=refno></td></tr>
<tr><td align=right>Email:</td><td><input type=text name=email1></td></tr>
<tr><td align=right>Email Again:</td><td><input type=text name=email2></td></tr>
<tr><td></td><td align=center><input class="s_text" type=submit value=Register></td></tr>
</form>



this is the code for the mail function
$recipient = $email;
  $subject = "Mywebsite Registration";
  $body = "Thank You for you're claim with my website\n\n";
  $body .= "You're Password is: ".$password."\n"; 
  $body .= "Thank you for registering\n";
  $body .= "To Login Please Visit http://www.mywebsite.co.uk/login.php";
  
  
  $from = "From: noreply@mywebsite.co.uk"; 
   
  if(mail($recipient,$subject,$body,$from))
  {
	echo "We have sent you a temporary password";
	?><br>Please Check your e-mail<br>
	<a href="login.php">Login</a><?php
  }else{
	echo "We havent sent you a temporary password";
  }



The variables are posting correctly from the form and the mail function sends to emails such as yahoo.co.uk and gmail.com but not to pop3 based addresses

This post has been edited by macbot: 09 September 2009 - 10:44 AM


Is This A Good Question/Topic? 0
  • +

Replies To: PHP Email Not working Properly

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 5954
  • View blog
  • Posts: 23,224
  • Joined: 23-August 08

Re: PHP Email Not working Properly

Posted 09 September 2009 - 10:44 AM

Mail is sent to a user's mail server though SMTP. It is retrieved via POP or IMAP (or web mail). The problem is therefore not really PHP, but the client.
Was This Post Helpful? 0
  • +
  • -

#3 macbot  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 22-April 09

Re: PHP Email Not working Properly

Posted 09 September 2009 - 10:47 AM

Client as in webhost or mailhost?
Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 5954
  • View blog
  • Posts: 23,224
  • Joined: 23-August 08

Re: PHP Email Not working Properly

Posted 09 September 2009 - 01:13 PM

Sounds like you need to read how email works. You don't send to a POP-based system; you send to an SMTP server. The end user uses POP or IMAP to get the mail from the mail server.

Another quick overview.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1