How to send email with wp_mail() with from email taken from contact form instead of the host?

I have set up SMTL like this, add_action( "phpmailer_init", "send_smtp_email" ); function send_smtp_email( $phpmailer ) { ini_set("sendmail_from","[email protected]"); ini_set("sendmail_path","[email protected]"); // Define that we are sending with SMTP $phpmailer->isSMTP(); // The hostname of the mail server $phpmailer->Host = "localhost"; // Use SMTP authentication (true|false) $phpmailer->SMTPAuth = false; // SMTP port number - likely to be 25, 465 or 587 $phpmailer->Port = "25"; // Encryption system to use - ssl or tls $phpmailer->SMTPSecure = "tls"; $phpmailer->From = "[email protected]"; $phpmailer->FromName = "XYZ"; } and …
Category: Web

How to disable Page Preview on sidebar in Page Editor in backend of wordpress?

I'm trying to update this contact page and it's not letting me click "update" because it's forcing me to fill out the form. When I do a test in the required fields, it's giving me an error. Therefore, I am not able to update the page. Is there a way to disable the preview in the sidebar? This is so frustrating! Side note - I did not build this site. It's awful.
Category: Web

How to set From filed in contact form 7 Use Mail (2) auto responder

I'm trying to set a contact form on my site but have a little problem with the auto responder (use mail 2) the From field. I'm testing it by myself so i act like an admin and a user on two different emils. When the filed is set to: [your name] <[your-email]> it throws an error: Sender email address does not belong to the site domain That's ok. But even when set to: [email protected] it goes to the sender junk …
Category: Web

Contact forms going into spam folder

When customers fill out the contact form on our site, the form goes straight into the spam folder in our gmail account. It never used to do this. Is this a Wordpress setting or a gmail setting that needs to be changes so that it sends to the inbox rather than the spam folder? Thanks
Category: Web

Email address used by website but I do not know where

I build a website for a client. This client then filled the website with content. I created 20 contact forms, using the contactform 7 and WP Mail SMTP Pro plugin. The website has now more than 100 pages. First my email address was used for the sites admin. I changed this later to my clients email address. I also used the client his email address for all of the contact forms. But now I still get a emails from the …
Category: Web

Email form getting hacked

I had a bit of a disturbing call from a potential client today. Apparently she filled in the form on the contact page, then a day or so later some other designers contacted her for the job, claiming they got her details on something called Bark. I’m not entirely sure what happened….it is possible that someone could get information like this? How can i prevent this?
Category: Web

Creating a contact form with Laravel frontend

I'm building my site with a Laravel frontend. The idea is that I can build the website in Laravel and simply use WordPress as a CMS for the content. I'm using Corcel to achieve this and so far it is working very well. One thing I need to do is implement a contact form. Ideally I'd like to use Laravel functionality, such as validation and saving. However I need the form submissions to appear in the WordPress admin. What is …
Category: Web

Is it secure to use SMTP password in .php file in WordPress website?

Currently I am making feedback contact form without a plugin. Trying not to use plugins if possible. In action .php file there must be written server settings such as SMTP server, SMTP username etc. and eventually SMTP password. As it is not a Gmail, but hosting mailbox, SMTP password and mail password are the same. Says, that sending mail using SMTP is more secure. But if I will write all this data into my .php file insite WordPress platform will …
Category: Web

How to get current url in contact form 7

I'm using Contact Form 7 in my wordpress installation. I need to somehow pass a hidden field with the current page url in the contact form hidden field. I tried their custom function and tried the short code, no luck. wpcf7_add_shortcode('sourceurl', 'wpcf7_sourceurl_shortcode_handler', true); function wpcf7_sourceurl_shortcode_handler($tag) { if (!is_array($tag)) return ''; $name = $tag['name']; if (empty($name)) return ''; $html = '<input type="hidden" name="' . $name . '" value="http://' . $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"] . '" />'; return $html; } In the form edition I …
Category: Web

Contact Form 7 - Uncaught TypeError: wpcf7.initForm is not a function

I updated to WordPress 5.7 and Contact Form 7 v5.4. The new version is not compatible anymore with a js file (line 6 "wpcf7.initForm"), that a previous developer wrote for our theme. Unfortunately I can't find a way to adapt the code so initForm get's recognized again. There are several suggestions with extra functions and I tried to copy them to different lines in the file, but the error won't disappear. Can someone please tell me, how I can correctly …
Category: Web

Contact form 7: Prevent input html tag in text field

How to create validation in contact form 7 to prevent user input HTML tag like ... or , also to prevent scripts like $(dummy){}. I create validation to prevent URL and non Latin characters, how I can create for HTML tag or scripts? Here my code: function custom_text_validation_filter($result, $tag) { $type = $tag['type']; $name = $tag['name']; if($name == 'your-subject') { $value = $_POST[$name]; $nourl_pattern = '(http|https|href)'; $latin = "/^[a-zA-ZàèìòùÀÈÌÒÙáéíóúýÁÉÍÓÚÝâêîôûÂÊÎÔÛãñõÃÑÕäëïöüÿÄËÏÖÜŸçÇßØøÅåÆæœ\s\d.('\"£$%!&*()}{@#~><>|=_+^?\/\\;:,,.)]+$/"; if(preg_match($nourl_pattern,$value)){ $result->invalidate( $tag, "Subject cannot contain website addresses." ); } else …
Category: Web

Wordpress - Users with contact form on profile

I should build a site, where the users sign up and can create and customize a profile like a social media. But instead of adding friends to a friendlist (like fb ect.), all the sites should have a contact form from where the visitor could send them a request on email. So basic requirments: User login and registration, Contact form on each user profile to contact the individual How would you handle a job like that? Any smart plug-ins, that …
Category: Web

Mail function is not working

My mail function is not working. When I submit form it says mail sent. But not receiving. I tried echo if the mail sent. It is also working. What is the issue here? Anything with mail function ? <?php $name = $_POST[ 'cuf_sender' . $n ]; $email = $_POST[ 'cuf_email' . $n ]; $subject = $this->o['subpre'] . ' ' . $_POST[ 'cuf_subject' . $n ]; $msg = $_POST[ 'cuf_msg' . $n ]; $extra = ''; foreach ( $_POST as $k …
Category: Web

Contact Form 7 plugin refreshing page on submit

For those with experience of the Contact Form 7 plugin - When I installed it, the form worked fine, and upon pressing the submit button, there was no page load, all done via Ajax, however now the page loads upon pressing submit. I have not made any changes to the form. I have tried deactivating then activating but the problem remains. Has anyone else had this problem before? Thanks
Category: Web

advanced custom fields and contact form 7

I want to use contact form 7 shortcode in advanced custom fields I created field called shortcode with advanced custom fields and put the contact form 7 shortcode in it. it displayed the form as frontend but no functionality. I am using the free version of advanced custom fields. also I choose the type of the field as wysewig then here is the code <?php echo get_field('shortcode'); ?> I used the shortcode of contact form 7 on another page and …
Category: Web

Why is my contact form not working?

Im new to Wordpress but have been tinkering with a website for my upcomming bussines. I have run into some problems here And there, but have been managing most things in an acceptabele way. But, i Just cant get my contact form to actually send me the emails... My website is : www.hondtel.be hosted at one.com Screenshots of the contact form setup supplied in this post. What am i doing wrong here?
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.