Jump to content

Search the Community

Showing results for tags 'mail function'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. <form action="forgotPsw.php" method="post"> Enter you Email Address: <input type="text" name="email"> <input type="submit" name="submit" value="Send"> </form> With this code am trying to send an email using mail function, which is not doing that and with no errors displaying, so i cant really figure out what is the problem since its updating the database giving the write echo statements but the email is not going through? please assist me <?php error_reporting(0); $email=$_POST['email']; if($_POST['submit']=='Send') { require_once "my database"; mysql_connect($svr, $dba, $pwd) or die(mysql_error); mysql_select_db($dbt); $query="select * from users where Email='$email'"; $result=mysql_query($query) or die(error); // checks if the username is in use if(mysql_num_rows($result)){ echo "User exist ----"; }else{ echo "No user exist with this email address----"; } if(mysql_num_rows($result)){ //$code=rand(100,999); //$message="You activation link is: http://10.10.200.250/cmsintranet/forgotPsw.php?email=$email&code=$code"; //mail($email, "Activation link", $message); //send email $mail->Mailer = "smtp"; $mail->Host = "my host"; $mail->Port = 25; $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "i used an email address"; // SMTP username $mail->Password = "psw to the email"; // SMTP password //create a new random password $password = substr(md5(uniqid(rand(),1)),3,10); $pass = md5($password); //encrypted version for database entry $to = "$email"; $subject = "Account Details Recovery"; $body = "Hi $r->username, nn you or someone else have requested your account details. nn Here is your account information please keep this as you may need this at a later stage. nnYour username is $r->username nn your password is $password nn Your password has been reset please login and change your password to something more rememberable.nn Regards Site Admin"; $additionalheaders = "From: <email.......>rn"; mail($to, $subject, $body, $additionalheaders); //update database $sql = mysql_query("UPDATE users SET u_password='$pass' WHERE Email = '$email'")or die (mysql_error()); $rsent = true; //show any errors if (!empty($error)){ $i = 0; while ($i < count($error)){ //echo "<div class="msg-error">".$error[$i]."</div>"; $i ++; } } if ($rsent == true){ echo "<p>You have been sent an email with your account details to $email</p>"; } else { echo "<p>Please enter your e-mail address. You will receive a new password via e-mail.</p>"; } //echo "Email sent"; }else{ echo "Email not sent"; } } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.