473,507 Members | 9,611 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to configure XAMPP so that i can use the mail() function

2 New Member
i am trying to use the mail() function in PHP using these files i have downloaded in the internet.
I have this error:
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\mail\signup_ac.php on line 39
Cannot send Confirmation link to your e-mail address

the source code for signup_ac.php:
Expand|Select|Wrap|Line Numbers
  1.  
  2. <?php
  3.  
  4. include('config.php');
  5.  
  6. // table name 
  7. $tbl_name=temp_members_db;
  8.  
  9. // Random confirmation code 
  10. $confirm_code=md5(uniqid(rand())); 
  11.  
  12. // values sent from form 
  13. $name=$_POST['name'];
  14. $email=$_POST['email'];
  15. $country=$_POST['country'];
  16.  
  17. // Insert data into database 
  18. $sql="INSERT INTO $tbl_name(confirm_code, name, email, password, country)VALUES('$confirm_code', '$name', '$email', '$password', '$country')";
  19. $result=mysql_query($sql);
  20.  
  21. // if suceesfully inserted data into database, send confirmation link to email 
  22. if($result){
  23. // ---------------- SEND MAIL FORM ----------------
  24.  
  25. // send e-mail to ...
  26. $to=$email;
  27.  
  28. // Your subject
  29. $subject="Your confirmation link here";
  30.  
  31. // From
  32. $header="from: your name <your email>";
  33.  
  34. // Your message
  35. $message="Your Comfirmation link \r\n";
  36. $message.="Click on this link to activate your account \r\n";
  37. $message.="http://www.yourweb.com/confirmation.php?passkey=$confirm_code";
  38.  
  39. // send email
  40. $sentmail = mail($to,$subject,$message,$header);
  41. }
  42.  
  43. // if not found 
  44. else {
  45. echo "Not found your email in our database";
  46. }
  47.  
  48. // if your email succesfully sent
  49. if($sentmail){
  50. echo "Your Confirmation link Has Been Sent To Your Email Address.";
  51. }
  52. else {
  53. echo "Cannot send Confirmation link to your e-mail address";
  54. }
  55. ?>
  56.  
Jul 7 '12 #1
2 3060
Luuk
1,047 Recognized Expert Top Contributor
It means you did not setup your mailserver correctly

here's a youtube-movie on how to do it
Jul 7 '12 #2
reymarkbacon
2 New Member
thank you very much for that link. :)
Jul 10 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
6507
by: martin | last post by:
Just the simplest invocation with hard coded parameters, followed by echoing a message, hangs for exactly 1 minute. ("defaulttimeout" in php.ini is set to 30 (seconds)). If I don't wait, and...
3
2645
by: Lu | last post by:
Hi, I have a redhat 9 linux machine running apache 2.0.47, mysql 4.0.15, and php 4.3.4. I have been puzzled by this mail() problem for quite a while, could someone please give me some hint on...
2
3664
by: JB | last post by:
Hello, I have installed Apache2.0 and PHP4.3 on my PC under Windows XP. What are the different steps to make the mail function work. I think I have to install first a mail server, but I don't...
4
4807
by: Data Goob | last post by:
This one has me stumped. How did SuSE disable the mail() function in their RPM'd version of PHP? ( This is their install-version of PHP with RPMs not what you download from PHP.net ) I have...
1
1011
by: anandaraman | last post by:
Hi all. i need help from u. i use the mail function, but error displays. how to rectify. please help the coding is <?php $to = "somebody@example.com"; $subject = "My subject"; $txt = "Hello...
9
2884
by: shror | last post by:
hi every body, i have a problem which is when i was checking my mail() form it work fine but the problem is that the form configuration is not set correctly, in details: the from var is not...
8
4289
by: anandaraman | last post by:
Hi all, i want to send mail through php coding.but error displays. i am working in windows environment. please help.. PHP Coding: <?php $to = "anandh@yahoo.com"; $subject = "Example"; $txt =...
0
1520
by: Bala | last post by:
Hi Experts, I'm using Xampp control for php and i set the smtp configuration in php.ini as SMTP=mail.domainserver.com smtp_port=25 but still i got an error like this.
8
2017
by: gggram2000 | last post by:
Hi Im new to this mail function. I have an html page with textboxes, comboboxes and textarea...i'ved named them all and created this php sendmail.php file to send all the data. The only thing is when...
6
1580
by: Call Me Tom | last post by:
The following simple script receives data from a form and sends me an email. It works fine on my testing machine (xampp for windows). However, when I upload it to my web host, the script processes...
0
7223
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,...
0
7110
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7314
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,...
1
7030
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...
0
7482
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...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3191
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...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.