• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

contact form, could anyone look it over not getting errors just not receiving the email

Joined
Mar 7, 2009
Messages
299 (0.05/day)
System Name Build 1
Processor i5 2500k
Motherboard Asus P8Z68-V PRO/GEN3
Cooling Cooler Master 212
Memory Corsair DDR3 1600
Video Card(s) onboard
Power Supply Corsair AX750
Software Windows 7 Professional
PHP:
<?php

// Your Name
$your_name ="$your name";

// Mail of sender
$your_email="$your email";


// Phone Number
$phone_number="$phone number";


// Subject
$subject="$subject";

// Your Message
$your_message="$your message";


// Enter your email address
$to ='info@mydomain.com';

$send_contact=mail($your_name,$your_email,$phone_number,$subject,$your_message);


// Check, if message sent to your email
// display message "We've recived your information"
if($send_contact){
echo "We've recived your contact information";
}
else {
echo "ERROR";
}
?>



<table width="960" border="0" cellpadding="0">
  <tr>
  <td><form id="form1" name="form1" method="post" action="contact.php">
  <p>
  <label>Your Name (required)
  <br />
  <input type="text" name="your name" id="your name" />
  </label>
  </p>
  <p>
  <label>Your Email (required)
  <br />
  <input type="text" name="your email" id="your email" />
  </label>
  </p>
  <p>
  <label>Your Phone No.<br />
  <input type="text" name="phone number" id="phone number" />
  </label>
  </p>
  <p>
  <label>Subject<br />
  <input type="text" name="subject" id="subject" />
  </label>
  </p>
  <p>
  <label>Your Message<br />
  <textarea name="your message" id="your message" cols="65" rows="5"></textarea>
  </label>
  </p>
  <p>
  <input name="submit" type="submit" id="submit" onclick="MM_validateForm('your name','','R','your email','','R');return document.MM_returnValue" value="Submit" />
  </p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  </form></td>
  </tr>
</table>
 
Last edited by a moderator:
Joined
Mar 26, 2006
Messages
517 (0.08/day)
Location
Stamford, UK
System Name The Money Sink
Processor Intel i7-5960X at 4.60Ghz
Motherboard MSI X99A Godlike
Cooling Custom watercooling loop, single D5 -> CPU, dual D5 -> GPU's
Memory 64GB DDR4-3000
Video Card(s) 2 x 1080Ti @ Stock for the moment (40oC LOAD)
Storage 960GB Mushkin Scorpion Deluxe and 2 x 512GB M.2 SSD RAID0
Display(s) Dual Curved LG 34" Display
Power Supply EVGA 1600W G2
Software Windows 10
Benchmark Scores ALOT
Looks to be fine unfortunately; What version of PHP is running on the server? Is there any firewall in place.

One thing I've noticed is that you change from double quotes to single quotes for the to address:

$to ='info@mydomain.com';
 
Joined
Mar 7, 2009
Messages
299 (0.05/day)
System Name Build 1
Processor i5 2500k
Motherboard Asus P8Z68-V PRO/GEN3
Cooling Cooler Master 212
Memory Corsair DDR3 1600
Video Card(s) onboard
Power Supply Corsair AX750
Software Windows 7 Professional
Looks to be fine unfortunately; What version of PHP is running on the server? Is there any firewall in place.

One thing I've noticed is that you change from double quotes to single quotes for the to address:

$to ='info@mydomain.com';
php 5.4.21

fixed the quote issue, changed the email address to send too also, same problem
 
Last edited:
Joined
Mar 26, 2006
Messages
517 (0.08/day)
Location
Stamford, UK
System Name The Money Sink
Processor Intel i7-5960X at 4.60Ghz
Motherboard MSI X99A Godlike
Cooling Custom watercooling loop, single D5 -> CPU, dual D5 -> GPU's
Memory 64GB DDR4-3000
Video Card(s) 2 x 1080Ti @ Stock for the moment (40oC LOAD)
Storage 960GB Mushkin Scorpion Deluxe and 2 x 512GB M.2 SSD RAID0
Display(s) Dual Curved LG 34" Display
Power Supply EVGA 1600W G2
Software Windows 10
Benchmark Scores ALOT
Oh and big no no is space in names for variables. Use underscore or dashes if you really want to keep words separated. <--- Ignore this, I read it wrong...

I'll put your code onto my website and see if it makes more sense in a HTML editor.

EDIT - Have a look at this example: http://www.freecontactform.com/email_form.php
 
Last edited:
Joined
Mar 7, 2009
Messages
299 (0.05/day)
System Name Build 1
Processor i5 2500k
Motherboard Asus P8Z68-V PRO/GEN3
Cooling Cooler Master 212
Memory Corsair DDR3 1600
Video Card(s) onboard
Power Supply Corsair AX750
Software Windows 7 Professional
Oh and big no no is space in names for variables. Use underscore or dashes if you really want to keep words separated. <--- Ignore this, I read it wrong...

I'll put your code onto my website and see if it makes more sense in a HTML editor.

EDIT - Have a look at this example: http://www.freecontactform.com/email_form.php
hopefully you will be able to find the problem, i will look at that example. It has something to do with sending i know that lol

im very new to php
 
Joined
Feb 18, 2010
Messages
1,850 (0.36/day)
System Name Eldritch
Processor AMD Ryzen 5 5800X3D
Motherboard ASUS TUF X570 Pro Wifi
Cooling Satan's butthole after going to Taco Bell
Memory 64 GB G.Skill TridentZ
Video Card(s) Vega 56
Storage 6*8TB Western Digital Blues in RAID 6, 2*512 GB Samsung 960 Pros
Display(s) Acer CB281HK
Case Phanteks Enthoo Pro PH-ES614P_BK
Audio Device(s) ASUS Xonar DX
Power Supply EVGA Supernova 750 G2
Mouse Razer Viper 8K
Software Debian Bullseye
Use code tags next time.
 
Joined
Mar 7, 2009
Messages
299 (0.05/day)
System Name Build 1
Processor i5 2500k
Motherboard Asus P8Z68-V PRO/GEN3
Cooling Cooler Master 212
Memory Corsair DDR3 1600
Video Card(s) onboard
Power Supply Corsair AX750
Software Windows 7 Professional
Use code tags next time.
anything else you can contribute?

has anyone else had a chance to look over it to see what I'm missing?
 

Easy Rhino

Linux Advocate
Staff member
Joined
Nov 13, 2006
Messages
15,444 (2.43/day)
Location
Mid-Atlantic
System Name Desktop
Processor i5 13600KF
Motherboard AsRock B760M Steel Legend Wifi
Cooling Noctua NH-U9S
Memory 4x 16 Gb Gskill S5 DDR5 @6000
Video Card(s) Gigabyte Gaming OC 6750 XT 12GB
Storage WD_BLACK 4TB SN850x
Display(s) Gigabye M32U
Case Corsair Carbide 400C
Audio Device(s) On Board
Power Supply EVGA Supernova 650 P2
Mouse MX Master 3s
Keyboard Logitech G915 Wireless Clicky
Software The Matrix
anything else you can contribute?

has anyone else had a chance to look over it to see what I'm missing?

I am confused by the topic? So your form is fine. Your problem is you are not getting the email? Do you have an email server setup to send email????
 

Mindweaver

Moderato®™
Staff member
Joined
Apr 16, 2009
Messages
8,193 (1.49/day)
Location
Charleston, SC
System Name Tower of Power / Sechs
Processor i7 14700K / i7 5820k @ 4.5ghz
Motherboard ASUS ROG Strix Z690-A Gaming WiFi D4 / X99S GAMING 7
Cooling CM MasterLiquid ML360 Mirror ARGB Close-Loop AIO / CORSAIR Hydro Series H100i Extreme
Memory CORSAIR Vengeance LPX 32GB (2 x 16GB) DDR4 3600 / G.Skill DDR4 2800 16GB 4x4GB
Video Card(s) ASUS TUF Gaming GeForce RTX 4070 Ti / ASUS TUF Gaming GeForce RTX 3070 V2 OC Edition
Storage 4x Samsung 980 Pro 1TB M.2, 2x Crucial 1TB SSD / Samsung 870 PRO 500GB M.2
Display(s) Samsung 32" Odyssy G5 Gaming 144hz 1440p, ViewSonic 32" 72hz 1440p / 2x ViewSonic 32" 72hz 1440p
Case Phantek "400A" / Phanteks “Enthoo Pro series”
Audio Device(s) Realtek ALC4080 / Azalia Realtek ALC1150
Power Supply Corsair RM Series RM750 / Corsair CXM CX600M
Mouse Glorious Gaming Model D Wireless / Razer DeathAdder Chroma
Keyboard Glorious GMMK with box-white switches / Keychron K6 pro with blue swithes
VR HMD Quest 3 (128gb) + Rift S + HTC Vive + DK1
Software Windows 11 Pro x64 / Windows 10 Pro x64
Benchmark Scores Yes
Yea your form is fine. I'm with Easy Rhino do you have an email server setup? Also, you can test run php code online here. Paste your PHP code in and run code in the future. :toast:

EDIT: Forgot to add that last little part.. lol
 
Last edited:

Solaris17

Super Dainty Moderator
Staff member
Joined
Aug 16, 2005
Messages
25,862 (3.79/day)
Location
Alabama
System Name Rocinante
Processor I9 14900KS
Motherboard EVGA z690 Dark KINGPIN (modded BIOS)
Cooling EK-AIO Elite 360 D-RGB
Memory 64GB Gskill Trident Z5 DDR5 6000 @6400
Video Card(s) MSI SUPRIM Liquid X 4090
Storage 1x 500GB 980 Pro | 1x 1TB 980 Pro | 1x 8TB Corsair MP400
Display(s) Odyssey OLED G9 G95SC
Case Lian Li o11 Evo Dynamic White
Audio Device(s) Moondrop S8's on Schiit Hel 2e
Power Supply Bequiet! Power Pro 12 1500w
Mouse Lamzu Atlantis mini (White)
Keyboard Monsgeek M3 Lavender, Akko Crystal Blues
VR HMD Quest 3
Software Windows 11
Benchmark Scores I dont have time for that.
do you have sendmail enabled on your server?
 

silentbogo

Moderator
Staff member
Joined
Nov 20, 2013
Messages
5,473 (1.44/day)
Location
Kyiv, Ukraine
System Name WS#1337
Processor Ryzen 7 3800X
Motherboard ASUS X570-PLUS TUF Gaming
Cooling Xigmatek Scylla 240mm AIO
Memory 4x8GB Samsung DDR4 ECC UDIMM
Video Card(s) Inno3D RTX 3070 Ti iChill
Storage ADATA Legend 2TB + ADATA SX8200 Pro 1TB
Display(s) Samsung U24E590D (4K/UHD)
Case ghetto CM Cosmos RC-1000
Audio Device(s) ALC1220
Power Supply SeaSonic SSR-550FX (80+ GOLD)
Mouse Logitech G603
Keyboard Modecom Volcano Blade (Kailh choc LP)
VR HMD Google dreamview headset(aka fancy cardboard)
Software Windows 11, Ubuntu 20.04 LTS
Did you check the Spam folder? Most of the time if email comes from the unknown source - it is automatically moved to the spam folder. Had a similar problem with email redirection for one of my customer's project.
Another major problem is that you mail it wrong.
The correct syntax for mail is:
PHP:
bool mail ( string $to , string $subject , string $message [, string $additional_headers [,string $additional_parameters ]] )
.. so your "from" email is sent as a subject, phone # as the message and the actual message is considered an additional header for sendmail.
try it this way:
PHP:
$to      = 'someone@mail.com';
$subject = 'subject';
$message = 'message';
$headers = 'From: me@example.com' . "\r\n" .
    'Reply-To: me@example.com';

if(mail($to, $subject, $message, $headers))
{
  echo "message sent!";
}
else echo"Error!!!";
?>
 
Top