php – Mail Will Not Send from this Contact Form

After the captcha validates, website mail refuses to send. Can you see the problem in the code?

I’ve spent about a week on it, and I still can’t see any problem in it.

If you would take a look at the form, it’s here: https://www.onlinepianoteacher.org/contact/

When the send button is clicked, the spinner goes round and round but the mail never sends.

HTML

<div id="central">
    <div class="content">
        
        <div id="message">
        <form id="frmContact" action="contact.php" method="POST" novalidate>
            <div class="label">Name:</div>
            <div class="field">
                <input type="text" id="name" name="name" placeholder="enter your name here" title="Please enter your name" class="required" aria-required="true" required>
            </div>
            <div class="label">Email:</div>
            <div class="field">         
                <input type="text" id="email" name="email" placeholder="enter your email address here" title="Please enter your email address" class="required email" aria-required="true" required>
            </div>
            <div class="label">Phone Number:</div>
            <div class="field">         
                <input type="text" id="phone" name="phone" placeholder="enter your phone number here" title="Please enter your phone number" class="required phone" aria-required="true" required>
            </div>
            <div class="label">Comments:</div>
            <div class="field">         
                <textarea id="comment-content" name="content" placeholder="enter your comments here"></textarea>            
            </div>
            <div class="g-recaptcha" data-sitekey="<?php echo SITE_KEY; ?>"></div>          
            <div id="mail-status"></div>            
            <button type="Submit" id="send-message" style="clear:both;">Send Message</button>
        </form>
        <div id="loader-icon" style="display:none;"><img src="img/loader.gif" /></div>
        </div>      
    </div><!-- content -->
</div><!-- central -->  
</body>
</html>

contact.php

<?php
if($_POST)
{
require('constant.php');
    
    $user_name      = filter_var($_POST("name"), FILTER_SANITIZE_STRING);
    $user_email     = filter_var($_POST("email"), FILTER_SANITIZE_EMAIL);
    $user_phone     = filter_var($_POST("phone"), FILTER_SANITIZE_STRING);
    $content   = filter_var($_POST("content"), FILTER_SANITIZE_STRING);
    
    if(empty($user_name)) {
        $empty() = "<b>Name</b>";       
    }
    if(empty($user_email)) {
        $empty() = "<b>Email</b>";
    }
    if(empty($user_phone)) {
        $empty() = "<b>Phone Number</b>";
    }   
    if(empty($content)) {
        $empty() = "<b>Comments</b>";
    }
    
    if(!empty($empty)) {
        $output = json_encode(array('type'=>'error', 'text' => implode(", ",$empty) . ' Required!'));
        die($output);
    }
    
    if(!filter_var($user_email, FILTER_VALIDATE_EMAIL)){ //email validation
        $output = json_encode(array('type'=>'error', 'text' => '<b>'.$user_email.'</b> is an invalid Email, please correct it.'));
        die($output);
    }
    
    //reCAPTCHA validation
    if (isset($_POST('g-recaptcha-response'))) {
        
        require('component/recaptcha/src/autoload.php');        
        
        $recaptcha = new ReCaptchaReCaptcha(XXX);

        $resp = $recaptcha->verify($_POST('g-recaptcha-response'), $_SERVER('REMOTE_ADDR'));

          if (!$resp->isSuccess()) {
                $output = json_encode(array('type'=>'error', 'text' => '<b>Captcha</b> Validation Required!'));
                die($output);               
          } 
    }
    
    $toEmail = "billyjoeconor@gmail.com";
    $mailHeaders = "From: " . $user_name . "<" . $user_email . ">rn";
    $mailBody = "User Name: " . $user_name . "n";
    $mailBody .= "User Email: " . $user_email . "n";
    $mailBody .= "Phone: " . $user_phone . "n";
    $mailBody .= "Content: " . $content . "n";

    if (mail($toEmail, "Contact Mail", $mailBody, $mailHeaders)) {
        $output = json_encode(array('type'=>'message', 'text' => 'Hi '.$user_name .', thank you for the comments. We will get back to you shortly.'));
        die($output);
    } else {
        $output = json_encode(array('type'=>'error', 'text' => 'Unable to send email, please contact'.SENDER_EMAIL));
        die($output);
    }
}
?>

Fill Drop-down menu of Contact Form 7 with PHP

I want to populate the drop-down menu items of the CF7 from another database. The reason for this is that there might be a large number of items that might dynamically change every week. Adjusting the CF7 manually would be very frustrating.

I have tested the PHP with XYZ PHP Code plugin and it works. The code looks like this

$mydb = new wpdb('User','Password','mytable','localhost');
$rows = $mydb->get_results("SELECT `brand_name` FROM `brands`");
foreach ($rows as $obj) :
   echo ""$obj->brand_name" ";
endforeach;

The result of the script is values in double quotes, as requested by CF7 (Select):

"Taylor" "Line 6" "Kurzweil" "Nord"

Unfortunately, I cannot nest the short code of XYZ PHP Code into another short code of CF7.
This obviously cannot work: (select menu-446 (xyz-ips snippet="brands"))

Is there a way to do this?

Google Contact, Multiple addresses, only 1 shows on Google Maps

I have certain contacts with multiple address that I have saved and when searching within Google Maps, only 1 of their addresses will populate. I would like both to populate when I search so that I can chose if I’d like to travel to their regular home or vacation home. I have tried changing both saved addresses to “home” and then 1 address to “home” and the other to “other.” I can’t seem to get both to be searchable within the Map search bar or to show up when zooming in on the map.

photos – Contact apps lost access to media files

At some point in time (about a week ago) something happened to my Motorola Moto Z2 Play / Android 8.0 that caused my base apps (actually — just Contacts) to not have access to my media files (i.e. audio, photos etc.).

Examples:

  • all my custom ringtones (i.e. based on my own media files) were reset to default sound,
  • I cannot pick a photo for a contact because my contacts app keeps saying: “No pictures are available on the device”.

While first situation is resolved. I see my custom ringtone files in the list and I can go through my contacts and assign them again. But second situation is not resolved. I see this error all the time and I cannot change any contact’s photo.

This is verified as not a bug (tested three different contacts-like applications and all of them shows exactly the same message, when trying to change contact’s photo). But still, it seems that problem is limited to contacts-related apps only. Other apps still has read and write access to my custom files.

For example: :

  • (read) I can pick any photo or other custom file and attach it to an e-mail, send it as MMS or share it in any other way or
  • (read) upload it to OneDrive or Google Drive etc. or
  • (write) my Camera app is still able to make new photos and store them in “DCIM” or
  • (write) my sound recorder is able to record sound and write audio files.

The only thing that has changed on my phone recently and that I suspect as the cause of above metioned situation was Android 7.1.2 –> Android 8.0.0 update.

Is there anything I can do (since replacing contacts app didn’t resolve the situation) or check in this case? Or resetting the phone to factory defaults is the only option that I am left with?

javascript – Contact Form 7 Conditional redirect

As per this ticket on WordPress forum, I have added the below code to my contact form for conditional redirect.

<script type="text/javascript">
inputs = event.detail.inputs;
inputs.forEach( function(el) {
    if ( el.name == "menu-52" ) {
        if ( el.value == "Below $10,000" ) {
            location.href = "https://www.facebook.com";
        } else if ( el.value == "Above $10,000" ) {
            location.href = "https://google.co.in";
        }
    }
});
</script>

But this is not working for me on my contact form and there are some errors on the console also.

Can someone please have a look and let me know where I am making mistake?

Thank you.

View contact details after subscribe in WordPress

Any plugins to view stores contact information after click contact button n submit name, number n email?…

To view hidden contact information after subscribe

.

Domain Renewal – Unable to contact current registrar

I have a domain name which was registered with a registrar called enameco. It is due for renewal soon. Apparently the original registrar – enameco – do not exist anymore – atleast the original site is no more in action

When I do a WhoIS on my domain, here is what I get – (xxx are replaced with some private info). Specifically, it says that my current registrar is Endurance

Registry Domain ID: XXXXXX_DOMAIN_COM-VRSN
Registrar WHOIS Server: 
Registrar URL: 
Updated Date: XXXX
Creation Date: xxx
Registrar Registration Expiration Date: XXX
Registrar: ENDURANCE
Registrar IANA ID: 

Domain Status: clientTransferProhibited https://www.icann.org/epp#clientTransferProhibited

I dont have any information on current registrar Endurance – web/login – or anyway to renew my domain.

Any idea how to go about and renew the domain in this case

privacy – How to contact Microsoft regarding security flaw?

Here I see:

If you believe you have found a security vulnerability that meets Microsoft’s definition of a security vulnerability, please submit the report to MSRC at https://msrc.microsoft.com/create-report

Also here:

We want to know about a security vulnerability as soon as you’ve found it.

But..

When signing into the create-report page (via google auth or MS account), it signs in as expected but signs out ~5 seconds later (using Chrome, also in Chrome incognito, and safari on macOS Catalina).

After signing out, it redirects to https://msrc.microsoft.com/create-report:

enter image description here

I have called MS’s tech support number (the call center did not come across as knowledgable about cyber security), and emailed bounty@microsoft.com, but have not received a reply.

How can one submit a bug report on a security vulnerability – is there a direct phone number for MS Cyber Security?

php – What happens when someone fills in a contact form on a website?

First, click and submit events first on the submit button and form. These can trigger JavaScript which can completely change or replace the next step.

Then an HTTP request is made (using the method specified in the form’s method attribute) to the URL specified in the form’s action attribute.

The server receives the request and processes it. This might involve running a program. This program can be written in any programming language at all. PHP is one option.

That program might send an email. It might use the Simple Mail Transfer Protocol to do this directly. It might shell out to a local program like sendmail. It might use a webservice like Sendgrid.

I see that my hosting company has provided me a mail box with some arbitrary email address where the form submission gets returned to when it fails.

That doesn’t really make sense.

Perhaps that is the mailbox where the email’s From address resolves do, so if the email bounces it will end up there. That isn’t “the form submission” though, its several steps down the line from it.

Make contact form using Google Forms inside GitHub Page

I use github for hosting my website. I wish to include the possibility for the users to subscribe to a newsletter, which they should do adding their email to a submission form.

I thought that google forms could be a good option to collect the emails, as it is for free, but I don’t know how to include it on the github page.

Can you help me?