Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My SMTP Contact
#1
This plugin will help you to set up a contact form with captcha and checkbox. 
Plugin can be used SMTP (Simple Mail Transfer Protocol) to send mail.

Download: http://get-simple.info/extend/plugin/my-...tact/1221/

Demo: http://demo23.p9021271.beget.tech

Customization example.
Paste the code before the tag </ head> in your theme file (template.php).

CSS example (this only example - in some cases, you will need to adjust the CSS of your theme):
Code:
<style>
/* Form styles */
.m_smtp_c input, .m_smtp_c textarea, .m_smtp_c select {
    border: 1px solid #666;
    border-radius: 2px;
    font: 14px/20px Helvetica, Arial, sans-serif;
    padding: 6px;
    width: 50%;
}

.m_smtp_c input:focus, .m_smtp_c textarea:focus, .m_smtp_c select:focus {
    background-color: #f1f1f1;
    border: 1px solid #333;
    outline: none;
}

.m_smtp_c textarea {
    width: 70%;
}

.m_smtp_c input:required, .m_smtp_c textarea:required {
    box-shadow: 0px 0px 3px 2px rgba(255, 150, 150, 0.75);
}

.m_smtp_c input:invalid, .m_smtp_c textarea:invalid {
    box-shadow: 0px 0px 3px 2px rgba(255, 150, 150, 0.75);
}

.m_smtp_c input:valid, .m_smtp_c textarea:valid {
    border: 1px solid #666;
    box-shadow: none;
}



/*Buttons*/
.m_smtp_c input[type="submit"], .m_smtp_c input[type="reset"], .m_smtp_c input[type="button"] {
    width: auto;
    cursor: pointer;
    border: 1px solid #444;
    background-color: #444;
    border-radius: 2px;
    padding: 6px 14px;
    color: #f1f1f1;
    text-decoration: none;
}

.m_smtp_c input[type="submit"]:hover, .m_smtp_c input[type="reset"]:hover, .m_smtp_c input[type="button"]:hover  {
        background-color: #f1f1f1; 
        color: #444;
}
    


/*Checkbox*/
.m_smtp_c input[type="checkbox"] { 
    position: absolute;
    z-index: -1;
    opacity: 0;
    margin: 10px 0 0 7px; 
}

.m_smtp_c input[type="checkbox"] + label {
    display: block;
    position: relative;
    padding-left: 35px;
    margin-bottom: 20px;
    font: 14px/20px Helvetica, Arial, sans-serif;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.m_smtp_c input[type="checkbox"] + label:last-child { margin-bottom: 0; }

.m_smtp_c input[type="checkbox"] + label:before {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    border: 1px solid #666;
    border-radius: 2px;
    position: absolute;
    left: 0;
    top: 0;
    -webkit-transition: all .12s, border-color .08s;
    transition: all .12s, border-color .08s;
}

.m_smtp_c input[type="checkbox"]:checked + label:before {
    width: 10px;
    top: -5px;
    left: 5px;
    border-radius: 0;
    border-top-color: transparent;
    border-left-color: transparent;
    -webkit-transform: rotate(45deg);
    transform: rotate(45deg);
}



/* Radio */
.m_smtp_c input[type="radio"] {
    position: absolute;
    z-index: -1;
    opacity: 0;
    margin: 10px 0 0 7px;
}

.m_smtp_c input[type="radio"] + label {
    position: relative;
    padding: 0 0 0 35px;
    font: 14px/20px Helvetica, Arial, sans-serif;
    cursor: pointer;
}

.m_smtp_c input[type="radio"] + label:before {
    content: '';
    position: absolute;
    top: -3px;
    left: 0;
    width: 22px;
    height: 22px;
    border: 1px solid #666;
    border-radius: 50%;
    background: #FFF;
}

.m_smtp_c input[type="radio"] + label:after {
    content: '';
    position: absolute;
    top: 1px;
    left: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #666;
    box-shadow: inset 0 1px 1px rgba(0,0,0,.5);
    opacity: 0;
    transition: .2s;
}

.m_smtp_c input[type="radio"]:checked + label:after {
    opacity: 1;
}

.m_smtp_c input[type="radio"]:focus + label:before {
    /*box-shadow: 0 0 0 3px rgba(255,255,0,.7);*/
}

.m_smtp_c input[type="file"] {
    border: none;
    background: none;
    width: auto;
}

#my_captcha_code_input { width: 50px; }



/*Select*/
.m_smtp_c select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Cpath fill='%23000' fill-rule='evenodd' class='cls-1' d='M8,0L4.141,6.993,0.012,0.156Z'/%3E%3C/svg%3E%0A");
    background-repeat: no-repeat;
    /*background-color: #fff;*/
    display: block;
    width: 52%;
    border: 1px solid #a7a7a7;
    color: #32353a;
    font: 14px/20px Helvetica, Arial, sans-serif;
    padding: 7px 10px 7px 10px;
    height: 36px;
    vertical-align: top;
    outline: 0;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    -ms-appearance: none !important;
    appearance: none !important;
    border: 1px solid #666;
    border-radius: 2px;
    background-position: right 13px center;
    padding-right: 30px;
    /*
    background-position: 13px center;
    padding-left: 30px;
    */
}

.m_smtp_c select::-ms-expand {
    display: none;
}

.m_smtp_c select:focus,
.m_smtp_c select:active {
    border: 1px solid #333;
    outline: 0;
}



/*Alert*/
.m_smtp_c_alert_outer {
    position: fixed;
    top: 0; 
    left: 0;
    width: 100%;
    z-index:9999;
}

.m_smtp_c_alert_outer .m_smtp_c_frame {
    position:relative;
    z-index:9999;
}

.m_smtp_c_alerts_holder {
    position: absolute;
    width: 270px; 
    top: 50px;
    left: 50%;
    margin-left: -150px;
    z-index: 9999;
}

@media screen and (min-width: 1200px) {
    .m_smtp_c_alerts_holder { width: 540px;  margin-left: -300px; }
}

.m_smtp_c_alerts_holder .m_smtp_c_alert {
    position: absolute;
    top: -1000px;
    background-color: #FFEBA0;
    font: 1.2em Helvetica, Arial, sans-serif;
    border: 1px solid #FFFFFF;
    border-radius: 2px;
    margin-left: 60px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
}

.m_smtp_c_alerts_holder .m_smtp_c_alert .m_smtp_c_alert_header {
    font-size: 1.2em;
    margin: 10px;
}

.m_smtp_c_alerts_holder .m_smtp_c_alert .m_smtp_c_alert_text {
    font-size:0.9em;
    margin:10px 20px;
}

.m_smtp_c_alerts_holder .m_smtp_c_alert .m_smtp_c_alert_close_button {
    position: absolute;
    padding: 5px;
    top: 0;
    right: 0;
    outline: none;
}

.m_smtp_c_alerts_holder .message {
    color:#FFF;
    background-color:#6690C9;
    padding-right: 30px;
    white-space: pre-wrap;
}

.m_smtp_c_alert_close_button {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg fill='none' height='26' width='26' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M13 25c6.627 0 12-5.373 12-12S19.627 1 13 1 1 6.373 1 13s5.373 12 12 12zM9 9.5l7.7 7.8M16.7 9.5L9 17.3' stroke='%23FFFFFF' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2'/%3e%3c/svg%3e");
    background-repeat: no-repeat; 
    background-position: center;
    width: 26px;
    height: 26px;
}
</style>
JavaScript example (alert() function customization):
Code:
<script>
window.alert = function(header)
   {
        if (document.getElementById("m_smtp_c_alerts_holder")) {
        document.getElementById("m_smtp_c_alerts_holder").innerHTML = "";
        }
        else
        {
        // create the necessary DIV
        var m_smtp_cAlertOuter = document.createElement("div");
        m_smtp_cAlertOuter.className = "m_smtp_c_alert_outer";
        document.body.appendChild(m_smtp_cAlertOuter);

        var m_smtp_cAlertFrame = document.createElement("div");
        m_smtp_cAlertFrame.className = "m_smtp_c_frame";
        m_smtp_cAlertOuter.appendChild(m_smtp_cAlertFrame);
            
        var m_smtp_cAlertsHolder = document.createElement("div");
        m_smtp_cAlertsHolder.id = "m_smtp_c_alerts_holder";
        m_smtp_cAlertsHolder.className = "m_smtp_c_alerts_holder";
        m_smtp_cAlertFrame.appendChild(m_smtp_cAlertsHolder);
        }
    
        // create a DIV with the required window type
        var m_smtp_cAlert = document.createElement("div");
        m_smtp_cAlert.className = "m_smtp_c_alert message";
        document.getElementById("m_smtp_c_alerts_holder").appendChild(m_smtp_cAlert);
        m_smtp_cAlert.id = "m_smtp_c_alert";

        // create a DIV with window title
        var m_smtp_cAlertHeader = document.createElement("div");
        m_smtp_cAlertHeader.className = "m_smtp_c_alert_header";
        m_smtp_cAlert.appendChild(m_smtp_cAlertHeader);
    
        m_smtp_cAlertHeader.innerHTML = header;
        
        // add window close button
        var m_smtp_cAlertCloseButton = document.createElement("a");
        m_smtp_cAlertCloseButton.href = "#";
        m_smtp_cAlertCloseButton.className = "m_smtp_c_alert_close_button";
        m_smtp_cAlertCloseButton.onclick = function(ev) {
            if(!ev) {
                ev=window.event;
            }
            if (!document.all) ev.preventDefault(); else ev.returnValue = false;
            document.getElementById("m_smtp_c_alerts_holder").innerHTML = "";
        }
        m_smtp_cAlert.appendChild(m_smtp_cAlertCloseButton);
        
        m_smtp_cAlert.style.position = "relative";
        m_smtp_cAlert.style.top = "0";
        m_smtp_cAlert.style.display = "block";
  }
</script>
Reply
#2
A warning appears.
Code:
Warning: Cannot modify header information - headers already sent by (output started at /home/mydomen.ru/html/theme/Shopping-Cart/header.inc.php:11) in /home/u915147/star-jewelry.rent-sites.ru/html/plugins/my-smtp-contact.php on line 158
Reply
#3
(2019-08-03, 22:42:42)Oleg06 Wrote: A warning appears.
Code:
Warning: Cannot modify header information - headers already sent by (output started at /home/mydomen.ru/html/theme/Shopping-Cart/header.inc.php:11) in /home/u915147/star-jewelry.rent-sites.ru/html/plugins/my-smtp-contact.php on line 158

I haven't tested it in debugging mode. This warning does not affect the functionality of the plugin.
In file: my-smtp-contact.php, code:
PHP Code:
if ($m_smtp_c_digital_captcha == 'on') {
setcookie('MSC_digit'''time(), '/');

need to be removed. It fixed in 1.0.5.

Thanks.
Reply
#4
v1.0.6
- alternative fileds (you can create form elements, ability to send attachments)
Do not use 'id', 'name' attributes for alternative fields.

- save fields contents if incorrect input

- ability to send to multiple addresses
Reply




Users browsing this thread: 1 Guest(s)