Jump to content

whitt

Members
  • Posts

    44
  • Joined

  • Last visited

Everything posted by whitt

  1. okk i think the issue is my ajax url i have the form working then the php file is in the same directory but not when in the bin folder form.zip
  2. I just checked the JS console i have this POST http://localhost/contact_form/bin/contact_me.php 500 (Internal Server Error)
  3. Am i close to fixing this at least?
  4. How do you mean return true all the time?
  5. <?php // check if fields passed are empty if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['phone']) || empty($_POST['message']) || !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL)) { echo "No arguments Provided!"; return false; } $name = $_POST['name']; $email_address = $_POST['email']; $message = $_POST['message']; $phone = $_POST['phone']; // create email body and send it $to = 'email@gmail.com'; // put your email $email_subject = "Contact form submitted by: $name"; $email_body = "You have received a new message. \n\n". " Here are the details:\n \nName: $name \n ". "Email: $email_address\n Phone: $phone\n Message \n $message"; $headers = "From: whitegatescattery.com\n"; $headers .= "Reply-To: email@gmail.com"; mail($to,$email_subject,$email_body,$headers); return true; ?> This worked with Gmail i dont get why this <?php require_once './libPHPMailerAutoload.php'; // check if fields passed are empty // check if fields passed are empty $name = $_POST['name']; $email_address = $_POST['email']; $message = $_POST['message']; $phone = $_POST['phone']; if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['phone']) || empty($_POST['message']) || !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL)) { echo "No arguments Provided!"; return false; } $mail = new PHPMailer; $mail->isSMTP(); $mail->SMTPAuth= true; $mail->SMTPDebug = 1; $mail->Host = 'smtp-mail.outlook.com'; $mail->Username = 'email'; $mail->Password = 'pass'; $mail->SMTPSecure = 'tls'; $mail->Port = 587; $mail->From = $email_address; $mail->FromName = $name; $mail->addReplyTo('reply@outlook.com','reply'); $mail->addAddress('@outlook.com','me'); $mail->isHTML(true); $mail->Subject = "Contact Form has been submitted"; $mail->Body = "You have received a new message. <br><br>". " Here are the details:<br> Name: $name <br> Phone Number: $phone <br>". "Email: $email_address<br> Message <br> $message"; var_dump($mail->send()); return true; ?> Is causing my ajax to append my fail message
  6. I may have used the wrong terminology but i don't know why the form is not working
  7. Can someone have a look at this , if i take the php code below the return false it says the message is sent. contact_form.zip
  8. <?php require_once 'PHPMailerAutoload.php'; // check if fields passed are empty if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['message']) || !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL)) { echo "No arguments Provided!"; } $name = $_POST['name']; $email_address = $_POST['email']; $message = $_POST['message']; $mail = new PHPMailer; $mail->isSMTP(); $mail->SMTPAuth= true; $mail->SMTPDebug = 1; $mail->Host = 'smtp-mail.outlook.com'; $mail->Username = 'email'; $mail->Password = 'pass'; $mail->SMTPSecure = 'tls'; $mail->Port = 587; $mail->From = $email_address; $mail->FromName = $name; $mail->addReplyTo('reply@outlook.com','reply'); $mail->addAddress('testytestersontesting@outlook.com','Testy Testerson'); $mail->isHTML(true); $mail->Subject = "Contact Form has been submitted"; $mail->Body = "You have received a new message. <br><br>". " Here are the details:<br> Name: $name <br> Phone Number: $phone <br>". "Email: $email_address<br> Message <br> $message"; echo var_dump($mail->send()); return true; ?> I just flat out cannot see why this does not work , the script on its own works but when i try to integrate it into the form i get my ajax sending back my error alert.
  9. Ok so i just made a test email address testy testerson , i an send emails from the testy account to my email account , i literally changed no code.
  10. Thing is this was working fine like 10 minutes ago i managed to send like 8 emails.
  11. i have to use outlook as its what my mate wants to use for this form
  12. If my AJAX is working it has to be on the PHP end
  13. Literally 5 minutes later and i get this " 2015-03-06 11:59:37 CLIENT -> SERVER: EHLO localhost 2015-03-06 11:59:37 CLIENT -> SERVER: STARTTLS 2015-03-06 11:59:37 CLIENT -> SERVER: EHLO localhost 2015-03-06 11:59:38 CLIENT -> SERVER: AUTH LOGIN 2015-03-06 11:59:38 CLIENT -> SERVER: bWF0dGhld3B3aGl0dGluZ3RvbkBvdXRsb29rLmNvbQ== 2015-03-06 11:59:38 CLIENT -> SERVER: TWF2ZXJpY2s4OQ== 2015-03-06 11:59:39 CLIENT -> SERVER: MAIL FROM: 2015-03-06 11:59:39 CLIENT -> SERVER: RCPT TO: 2015-03-06 11:59:39 CLIENT -> SERVER: DATA 2015-03-06 11:59:39 CLIENT -> SERVER: Date: Fri, 6 Mar 2015 11:59:37 +0000 2015-03-06 11:59:39 CLIENT -> SERVER: To: Matthew Whittington 2015-03-06 11:59:39 CLIENT -> SERVER: From: matthewpwhittington@outlook.com 2015-03-06 11:59:39 CLIENT -> SERVER: Reply-To: sender 2015-03-06 11:59:39 CLIENT -> SERVER: Subject: Testing Email 2015-03-06 11:59:39 CLIENT -> SERVER: Message-ID: <26e958edff522d3f6a43f03aaf8bab81@localhost> 2015-03-06 11:59:39 CLIENT -> SERVER: X-Priority: 3 2015-03-06 11:59:39 CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.9 (https://github.com/PHPMailer/PHPMailer/) 2015-03-06 11:59:39 CLIENT -> SERVER: MIME-Version: 1.0 2015-03-06 11:59:39 CLIENT -> SERVER: Content-Type: multipart/alternative; 2015-03-06 11:59:39 CLIENT -> SERVER: boundary="b1_26e958edff522d3f6a43f03aaf8bab81" 2015-03-06 11:59:39 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit 2015-03-06 11:59:39 CLIENT -> SERVER: 2015-03-06 11:59:39 CLIENT -> SERVER: --b1_26e958edff522d3f6a43f03aaf8bab81 2015-03-06 11:59:39 CLIENT -> SERVER: Content-Type: text/plain; charset=us-ascii 2015-03-06 11:59:39 CLIENT -> SERVER: 2015-03-06 11:59:39 CLIENT -> SERVER: This is a Test Email 2015-03-06 11:59:39 CLIENT -> SERVER: 2015-03-06 11:59:39 CLIENT -> SERVER: 2015-03-06 11:59:39 CLIENT -> SERVER: --b1_26e958edff522d3f6a43f03aaf8bab81 2015-03-06 11:59:39 CLIENT -> SERVER: Content-Type: text/html; charset=us-ascii 2015-03-06 11:59:39 CLIENT -> SERVER: 2015-03-06 11:59:39 CLIENT -> SERVER: This is a Test Email ssl 2015-03-06 11:59:39 CLIENT -> SERVER: 2015-03-06 11:59:39 CLIENT -> SERVER: 2015-03-06 11:59:39 CLIENT -> SERVER: 2015-03-06 11:59:39 CLIENT -> SERVER: --b1_26e958edff522d3f6a43f03aaf8bab81-- 2015-03-06 11:59:39 CLIENT -> SERVER: 2015-03-06 11:59:39 CLIENT -> SERVER: . 2015-03-06 11:59:40 SMTP ERROR: DATA END command failed: 550 5.3.4 Requested action not taken; To continue sending messages, please sign in to your account. 2015-03-06 11:59:40 SMTP Error: data not accepted. bool(false) 2015-03-06 11:59:40 CLIENT -> SERVER: QUIT 2015-03-06 11:59:40 SMTP ERROR: QUIT command failed:" @outlook.com>@outlook.com>@outlook.com>@outlook.com>
  14. I did a basic just send an email PHP scrip i have the emails going to my in box with this <?php require_once 'PHPMailerAutoload.php'; $mail = new PHPMailer; $mail->isSMTP(); $mail->SMTPAuth= true; $mail->Host = 'smtp-mail.outlook.com'; $mail->Username = 'myemail@outlook.com'; $mail->Password = 'pass'; $mail->SMTPSecure = 'tls'; $mail->Port = 587; $mail->From = 'sender@outlook.com'; $mail->FromName = $name; $mail->addReplyTo('sender@outlook.com',$name); $mail->addAddress('myemail@outlook.com',me); $mail->Subject = 'Testing Email'; $mail->Body = 'This is a Test Email ssl'; $mail->AltBody ='This is a Test Email'; var_dump($mail->send()); ?>
  15. Ok so .... it works with TLS but refuses to let me use SSL .... why Microsoft...
  16. With Gmail when the form is submitted i get a suspicious sign in attempt email from Gmail.
  17. Console doesn't appear to be coming up with anything which is odd as this script seems to work with other php mail scripts i've written it only seems to not like phpmailer. I have attached my files , im going to keep looking at it but i cant see whats wrong. test.zip
  18. Ill be doing that tomorrow mate , its late in my timezone.
  19. What makes the URL seem odd?
  20. Ill rebuild workable version and post it
  21. It seems to submit fine it just never shows up
  22. I am attempting to create a php AJAX contact form , however the email never seems to arrive in my outlook. /* Jquery Validation using jqBootstrapValidation example is taken from jqBootstrapValidation docs */ $(function() { $("input,textarea").jqBootstrapValidation( { preventSubmit: true, submitError: function($form, event, errors) { // something to have when submit produces an error ? // Not decided if I need it yet }, submitSuccess: function($form, event) { event.preventDefault(); // prevent default submit behaviour // get values from FORM var name = $("input#name").val(); var email = $("input#email").val(); var phone = $("input#phone").val(); var message = $("textarea#message").val(); var firstName = name; // For Success/Failure Message // Check for white space in name for Success/Fail message if (firstName.indexOf(' ') >= 0) { firstName = name.split(' ').slice(0, -1).join(' '); } $.ajax({ url: "./bin/contact_me.php", type: "POST", data: {name: name,phone:phone, email: email, message: message}, cache: false, success: function() { // Success message $('#success').html("<div class='alert alert-success'>"); $('#success > .alert-success').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×") .append( "</button>"); $('#success > .alert-success') .append("<strong>Your message has been sent. </strong>"); $('#success > .alert-success') .append('</div>'); //clear all fields $('#contactForm').trigger("reset"); }, error: function() { // Fail message $('#success').html("<div class='alert alert-danger'>"); $('#success > .alert-danger').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×") .append( "</button>"); $('#success > .alert-danger').append("<strong>Sorry "+firstName+" it seems that my mail server is not responding...</strong> Could you please email me directly ? Sorry for the inconvenience!"); $('#success > .alert-danger').append('</div>'); //clear all fields $('#contactForm').trigger("reset"); }, }) }, filter: function() { return $(this).is(":visible"); }, }); $("a[data-toggle=\"tab\"]").click(function(e) { e.preventDefault(); $(this).tab("show"); }); }); /*When clicking on Full hide fail/success boxes */ $('#name').focus(function() { $('#success').html(''); }); <?php require("../lib/phpmailer/PHPMailerAutoload.php"); if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['phone']) || empty($_POST['message']) || !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL)) { echo "No arguments Provided!"; return false; } $m = new PHPMailer(); $m->IsSMTP(); $m->SMTPAuth = true; $m->SMTPDebug = 2; $m->Host = "smtp-mail.outlook.com"; $m->Username = ""; $m->Password = ""; $m->SMTPSecure = 'tls'; $m->Port = 587; $m->addAddress('EXAMPLE@outlook.com', $name); $name = $_POST['name']; $email_address = $_POST['email']; $phone = $_POST['phone']; $message = $_POST['message']; $m->Subject = "Contact Form has been submitted"; $m->Body = "You have received a new message. <br><br>". " Here are the details:<br> Name: $name <br> Phone Number: $phone <br>". "Email: $email_address<br> Message <br> $message"; if(!$m->Send()) { echo "Mailer Error: " . $m->ErrorInfo; exit; } ?>
  23. Im struggling with how to filter items that have multiple categorises say if i wanted to search for a shoe that is good for walking and hiking in my database? Shoe_id Shoe name color_id type_id colors color_id color type type_id type My problem is what do i do in a situations like this? say a shoe is good for walking and running? aka type 1 and 2 shoe id 1 shoe name nike color id 1 type id 1 and 2
  24. how about if say theres a shoe type say types type_ID type but i wanted a shoe to be for basket ball and running Shoes: ID = 1, Name = 'Nike Free' Colors ID = 1, Name = 'Grey' ID = 2, Name = 'Yellow' Type type_id 1 type running type_id 2 type basketball Shoe_colors: ID = 1, Shoe_id = 1, Color_id = 1 type = 1 and 2 ?? ID = 2, Shoe_id = 1, Color_id = 2
×
×
  • 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.