contact-form.php send empty mails

Home Forums Porto – Responsive HTML5 Template contact-form.php send empty mails

Tagged: , ,

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #10009962
    Yelloweb
    Participant

    since three weeks the contact-form.php send “empty” mails.

    in the code of the “empty” mail:

    “X-PHP-Originating-Script: 1247:contact-form.php”

    and this also:


    Name: <br>
    Email address: <br>
    Message: <br>

    if i try to send a mail with the contact-form i can’t send a empty mail because of the validation.

    what is broken?

    yours

    Yellow


    #10009965
    Support
    Keymaster

    Hello, that’s strange, it’s probably an attempt to send SPAM, my suggestion is to add this kind of verification:

    if(!isset($_POST['name'])) {
       die();
    }

    Please try that and let me know if you need further assistance.

    Kind Regards, Jonas


    #10009969
    Yelloweb
    Participant

    Hello,

    what happend with the function die() and the contact-form?
    and why could send messages without the js-validation?
    how can some send this empty messages?

    yours,

    Yellow


    #10009970
    Yelloweb
    Participant

    Oh and i try to put html-tags in the contact form.

    i could send messages if i put a br-tag in to the name-field, subject-field and message-field.

    how can i edit the js-validation that no html-tags could be send with my contact-form?

    yours,

    Yellow


    #10009983
    Support
    Keymaster

    Hello, the solution I proposed is to check if the fields were filled, to avoid spam attempts to your domain. (sending data directly to the PHP file, not using the form). The php die() function will block and process.

    For the HTML tags, the template doesn’t come with anything specific for that, but you can try the following solutions:

    – Force PlainText on content via PHP: http://stackoverflow.com/questions/1884550/converting-html-to-plain-text-in-php-for-e-mail
    http://stackoverflow.com/questions/5422505/jquery-validation-to-check-text-contains-no-html

    I hope it helps.

    Kind Regards,

    Jonas


    #10009988
    Yelloweb
    Participant

    Hello,

    wich of this Codes should i use?
    and where should i add it?

    my english is not so good.

    yours,

    Yellow


    #10009994
    Support
    Keymaster

    Hello, it actually depends if you want to make the validation in the server side or only using Jquery, the first solution is for PHP and the second is Jquery.

    Jquery Solution:

    (js/custom.js)

    $.validator.addMethod('html', function(value, element, params) {
    	
    	if ($(element).val().match(/<(\w+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/)) {
    		return false;
    	}
    	
    	return true;
    
    }, 'Please enter a valid message.');

    Add the validation:

    (js/views/view.contact.js)

    Kind Regards,

    Jonas


Viewing 7 posts - 1 through 7 (of 7 total)

This topic is marked as "RESOLVED" and can not rceive new replies.