Hello all,
I just took over a website for a client and don’t have much experience in PHP coding to begin with, but I am trying to figure out why emails are not being sent to external email addresses on a submission form page. Quite frankly, I’m not entirely sure what I am doing. It feels like I’ve looked everywhere and tried everything but no such luck.
The page is set up so that there is a login page for sales reps to log in and send order forms. Once logged in, their email is already automatically written out based on what we have in our sQL database. When they submit the form, we do receive the email perfectly, and everything works. The problem is that they are unable to get a confirmation email back that their order has sent (even though a page will come up on the website saying the order has sent). The only time they do get an email back is if their address is under our domain (e.g. [email protected])
I looked at the SPF records, and it’s as it should be. I looked at the log files when the submission email is from a gmail account, and the log claims that the email has been received. But it is not in the inbox or spam folder (also tried whitelisting the “from” email address). I even talked with GoDaddy support, and they said everything was working properly on their end and it might be something wrong with the PHP code.
So. Here’s the code. I apologize if any of this is confusing, I’m still new to the world of coding and this code was thrust into my hands.
[php]<?php
session_start();
if (!isset($_SESSION[‘username’])) {
header(“Location: login.php”);
die();
}
$user = $_SESSION[‘username’];
$db = new mysqli(‘localhost’, ‘danpost_user’, ‘cJW2qpzjHy6eRqzn’, ‘danpost’);
$query = “UPDATE users SET email=’”.$_POST[‘email’]."’, rep=’".$_POST[‘rep’]."’, ponum=’".$_POST[‘po_no’]
."’ WHERE username=’".$user."’";
$result = $db->query($query);
$cbcTotal = 0;
$workTotal = 0;
$cbcTotal += $ext[‘dpcbc9’] = number_format($_POST[‘dpcbc9’] * 49.98, 2);
$subject = ‘Order Form’;
$message = '
Order Form Submitted
| '.$_POST['email'].' | |
| Date | '.$_POST['date'].' |
| Rep | '.$_POST['rep'].' |
| PO# | '.$_POST['po_no'].' |
Billing Information
if ($cbcTotal + $workTotal > 0) { Selected Products
|