Hi,
I've had my website up and running for about 3 years now. My form was working the first two years, however I noticed I wasn't receiving any inquiries in awhile and I believe I may be losing business. I have my own custom PHP, but should I be using godaddy's instead? Who can help me with this?
Here's the PHP coding I have:
<?php
$send_to = 'natasha.herbert@ymail.com';
$errors = array(); // array to hold validation errors
$data = array(); // array to pass back data
// validate the variables ======================================================
// if any of these variables don't exist, add an error to our $errors array
if (empty($_POST['inputName']))
$errors['name'] = 'Name is required.';
if (empty($_POST['inputEmail']))
$errors['email'] = 'Email is required.';
if (empty($_POST['inputSubject']))
$errors['subject'] = 'Subject is required.';
if (empty($_POST['inputMessage']))
$errors['message'] = 'Message is required.';
// return a response ===========================================================
// if there are any errors in our errors array, return a success boolean of false
if ( ! empty($errors)) {
// if there are items in our errors array, return those errors
$data['success'] = false;
$data['errors'] = $errors;
} else {
// if there are no errors process our form, then return a message
//If there is no errors, send the email
if( empty($errors) ) {
$subject = 'RSVP Form';
$headers = 'From: ' . $send_to . "\r\n" .
'Reply-To: ' . $send_to . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$message = 'Name: ' . $_POST['inputName'] . '
Email: ' . $_POST['inputEmail'] . '
Subject: ' . $_POST['inputSubject'] . '
Message: ' . $_POST['inputMessage'];
$headers = 'From: Website Form' . '<' . $send_to . '>' . "\r\n" . 'Reply-To: ' . $_POST['inputEmail'];
mail($send_to, $subject, $message, $headers);
}
// show a message of success and provide a true success variable
$data['success'] = true;
$data['message'] = 'Thank you!';
}
// return all our data to an AJAX call
echo json_encode($data);
Solved! Go to Solution.
The post you answered is exactly what I am trying to do. Unfortunately the URL provided in the response does not work. Can you update the link. Thank You.
You can contact to godaddy live support, or Phone number.. i face the same issue on my two sites which i purchase from godaddy they are ias coaching in delhi and second is Happy Valentines day
Amazing information admin thanks for sharing i like to show some thing to you Happy new year 2018 galaxy s9 iphone 9 ipl 2017 other site
Thanks a lot man. Your solution helped me out to sort out my problems. I really appreciate your efforts to post such a wonderful and explanatory solution.
Greetings,
I'm trying to send a mail on my website using PHPMailer. The function Send() returns OK but it does not work.
The is the output of the SMPTDebug
2017-02-22 09:11:07 Connection: opening to n1plcpnl0076.prod.ams1.secureserver.net:25, timeout=300, options =array (
)
2017-02-22 09:11:07 Connection: opened
2017-02-22 09:11:12 SERVER -> CLIENT: 220-n1plcpnl0076.prod.ams1.secureserver.net ESMTP Exim 4.87 #1
Wed, 22 Feb 2017 02:11:12 -0700
220-We do not authorize the use of this system to transport unsolicited
,
220 and/or bulk e-mail.
2017-02-22 09:11:12 CLIENT -> SERVER: EHLO website.com
2017-02-22 09:11:12 SERVER -> CLIENT: 250-n1plcpnl0076.prod.ams1.secureserver.net Hello n1plcpnl0076
.prod.ams1.secureserver.net [xxx.xxx.xx.xx]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-AUTH PLAIN LOGIN
250-STARTTLS
250 HELP
2017-02-22 09:11:12 CLIENT -> SERVER: STARTTLS
2017-02-22 09:11:12 SERVER -> CLIENT: 220 TLS go ahead
2017-02-22 09:11:12 CLIENT -> SERVER: EHLO website.com
2017-02-22 09:11:12 SERVER -> CLIENT: 250-n1plcpnl0076.prod.ams1.secureserver.net Hello xxxxxxxxxxx
.prod.ams1.secureserver.net [xxx.xxx.xx.xx]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-AUTH PLAIN LOGIN
250 HELP
2017-02-22 09:11:12 CLIENT -> SERVER: AUTH LOGIN
2017-02-22 09:11:12 SERVER -> CLIENT: xxxxxxxxxxxxxxxx
2017-02-22 09:11:12 CLIENT -> SERVER: xxxxxxx
2017-02-22 09:11:12 SERVER -> CLIENT: xxxxxxx
2017-02-22 09:11:12 CLIENT -> SERVER: xxxxxxx
2017-02-22 09:11:12 SERVER -> CLIENT: 235 Authentication succeeded
2017-02-22 09:11:12 CLIENT -> SERVER: MAIL FROM:<email@yahoo.fr>
2017-02-22 09:11:12 SERVER -> CLIENT: 250 OK
2017-02-22 09:11:12 CLIENT -> SERVER: RCPT TO:<email@gmail.com>
2017-02-22 09:11:12 SERVER -> CLIENT: 250 Accepted
2017-02-22 09:11:12 CLIENT -> SERVER: DATA
2017-02-22 09:11:12 SERVER -> CLIENT: 354 Enter message, ending with "." on a line by itself
2017-02-22 09:11:12 CLIENT -> SERVER: Date: Wed, 22 Feb 2017 09:11:07 +0000
2017-02-22 09:11:12 CLIENT -> SERVER: To: <email@gmail.com>
2017-02-22 09:11:12 CLIENT -> SERVER: From: email@yahoo.fr
2017-02-22 09:11:12 CLIENT -> SERVER: Subject: Subject of the email
2017-02-22 09:11:12 CLIENT -> SERVER: Message-ID: <27e10255b7a830747ef97bbbc85b3547@website.com>
2017-02-22 09:11:12 CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.15 (https://github.com/PHPMailer/PHPMailer)
2017-02-22 09:11:12 CLIENT -> SERVER: MIME-Version: 1.0
2017-02-22 09:11:12 CLIENT -> SERVER: Content-Type: multipart/alternative;
2017-02-22 09:11:12 CLIENT -> SERVER: boundary="b1_27e10255b7a830747ef97bbbc85b3547"
2017-02-22 09:11:12 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
2017-02-22 09:11:12 CLIENT -> SERVER:
2017-02-22 09:11:12 CLIENT -> SERVER: This is a multi-part message in MIME format.
2017-02-22 09:11:12 CLIENT -> SERVER:
2017-02-22 09:11:12 CLIENT -> SERVER: --b1_27e10255b7a830747ef97bbbc85b3547
2017-02-22 09:11:12 CLIENT -> SERVER: Content-Type: text/plain; charset=us-ascii
2017-02-22 09:11:12 CLIENT -> SERVER:
2017-02-22 09:11:12 CLIENT -> SERVER: This is the body in plain text for non-HTML mail clients
2017-02-22 09:11:12 CLIENT -> SERVER:
2017-02-22 09:11:12 CLIENT -> SERVER:
2017-02-22 09:11:12 CLIENT -> SERVER: --b1_27e10255b7a830747ef97bbbc85b3547
2017-02-22 09:11:12 CLIENT -> SERVER: Content-Type: text/html; charset=us-ascii
2017-02-22 09:11:12 CLIENT -> SERVER:
2017-02-22 09:11:12 CLIENT -> SERVER: <table border='0' cellpadding='2' cellspacing='2' width='600'>
2017-02-22 09:11:12 CLIENT -> SERVER: <tr><td>Email subscription for the newsletter <br></td></tr>
2017-02-22 09:11:12 CLIENT -> SERVER: <tr><td>Email: email@yahoo.fr</td></tr>
2017-02-22 09:11:12 CLIENT -> SERVER: </table>
2017-02-22 09:11:12 CLIENT -> SERVER:
2017-02-22 09:11:12 CLIENT -> SERVER:
2017-02-22 09:11:12 CLIENT -> SERVER:
2017-02-22 09:11:12 CLIENT -> SERVER: --b1_27e10255b7a830747ef97bbbc85b3547--
2017-02-22 09:11:12 CLIENT -> SERVER:
2017-02-22 09:11:12 CLIENT -> SERVER: .
2017-02-22 09:11:12 SERVER -> CLIENT: 250 OK id=1cgSx6-004KJg-Sv
2017-02-22 09:11:12 CLIENT -> SERVER: QUIT
2017-02-22 09:11:12 SERVER -> CLIENT: 221 n1plcpnl0076.prod.ams1.secureserver.net closing connection
2017-02-22 09:11:12 Connection: closed
The code for sending a mail is :
$mail = new PHPMailer;
$from = htmlentities(trim($_POST['emailR']));
$name = htmlentities(trim($_POST['prenomR'])) . ' ' . htmlentities(trim($_POST['nomR']));
$email = htmlentities(trim($_POST['emailR']));
$telephone = htmlentities(trim($_POST['telephoneR']));
$add_note = htmlentities(trim($_POST['addNoteR']));
$societeR = htmlentities(trim(nl2br($_POST['societeR'])));
$mail->setFrom($from, $name);
$message = "<table border='0' cellpadding='2' cellspacing='2' width='600'>
<tr><td>Nom: ".$name." </td></tr>
<tr><td>Telephone: ".$telephone." </td></tr>
<tr><td>Email: ".$email."</td></tr>
<tr><td>Societe: ".$societeR."</td></tr>
<tr><td>Note:".$add_note."</td></tr>
</table>";
$mail->isSMTP();
$mail->SMTPDebug = 3;
$mail->Host = 'n1plcpnl0076.prod.ams1.secureserver.net';
$mail->SMTPAuth = true;
$mail->Username = 'xxxxxxxxxx@n1plcpnl0076.prod.ams1.secureserver.net';
$mail->Password = 'xxxxxxxxx';
$mail->Port = 25;
$mail->addAddress('email@gmail.com', );
$mail->addBCC('email@gmail.com');
$mail->isHTML(true);
$mail->Subject = 'The subject of the mail ';
$mail->Body = $message;
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 1;
}
Hi @CAPTIVIS,
where have you defined the function send? If not defined it will always return true.
where is your code for checking that the fields are completed?
where is your code for filtering malicious code...................... http://stackoverflow.com/questions/14260665/php-htmlentities-not-enough-to-stop-hackers-injecting-ht...
What I'm selling has a special code for the service i am providing. so how do i set up the website to give them the special code?
I would prefer to send it by email.
But even if i can get it to pop up on the screen it would be great.
Thanks
Hello Sir,
We have a problem with sending mails from "Formidable" plugin for forms.
There are mail has to send to the form admin and another confirmation mail has to be send to the visitor how submit the form
We created test mails from the Cpanel and from "Workspace Email" but these test mails can't receive any mails notifications
While we tested by other external mails and it works good, so the problem is in the mails @fitsquadegypt.com
The site which has the plugin is http://www.fitsquadegypt.com/join
Can you please send your replies to saad@34medialabs.com too
Thanks!
i looking for these type of script really godaddy help me out them great thanks!!
Wish you all happy new year 2018
I have faced same problem in my 2 websites tiger zinda hai movie and padmavati movie but when i sent massage to support they fixed it up very firstly.
cancel my today subscription which you wrote bill after, i have subscribe today on 14 Sep 2018