Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Contact form with Aajax

Featured Replies

Hi,

 

Still not had much luck getting my contact form working over at my portfolio

 

My site

 

I have some AJAX which sends the input to a php page (process.php) but how can i then send it to my gmail account. Iv been trying PHPMailer but still not having alot of luck with that

 

Heres the Ajax

 

$(function() {
 $("#contact_form").submit(function() {
var name = $("input#name").val();
var email = $("input#email").val();
var phone = $("input#phone").val();
var reason = $("input#contact_reason").val();
var message = $("input#message").val();

var dataString = 'name='+ name + '&email=' + email + '&phone=' + phone + '&reason=' + reason + '&message=' + message;

	$.ajax({
     type: "POST",
     url: "/wp-content/themes/Portfolio/js/process.php",
     data: dataString,
     success: function() {
       $('#contact_form').html("<div id='message'></div>");
       $('#message').html("<h2  class='no-margin-title'>Contact Form Submitted!</h2>");
       $('#message').append("<img id='contact-tick' src='/wp-content/themes/Portfolio/images/tick.gif'/>")   
       .append("<h3>I will be in touch <span class='blog-sub-span'>soon</span></h3>")
       .hide()
       .fadeIn(1500, function() {
                 });
     }
    });
   return false;
});
});

 

What do i need to do in the process.php page to send it over to my gmail?

 

Thanks for any help

  • Author

Hmm still not working, i currently have this in the process.php page as a test

 

<html>
<body>

<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
 {
 //send email
 $email = $_REQUEST['email'] ;
 $message = $_REQUEST['message'] ;
 mail("ben.gibson.2011@gmail.com", "Testing",
 $message, "From:" . $email);
 }

?>

</body>
</html>

 

But im not getting anything in my gmail even in the spam folder :mellow:

Your host may not allow the PHP mail() function to be used as it does not require any authentication. Try using just PHPMailer and setting it up with SMTP authentication.

 

You could also try this: http://www.dotvoid.com/2007/04/problem-sending-mail-with-php-mail-function/

 

Also, you posted this thread twice which makes it more difficult for people to help you consistently.

Edited by Moose

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.