CINXE.COM

PHP Email Form | BootstrapMade

<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>PHP Email Form | BootstrapMade</title><meta content="PHP Email Form is simple and easy to use PHP script for sending the data submitted by web HTML forms (like contact forms) to your email inbox." name="description"><meta content="php email form, php email, php mail, php contact form, php form, php mail, php email" name="keywords"><link rel="canonical" href="https://bootstrapmade.com/php-email-form/"><link rel="icon" href="https://bootstrapmade.com/assets/img/favicon.png"><link rel="apple-touch-icon" href="https://bootstrapmade.com/assets/img/apple-touch-icon.png"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <style>@charset "UTF-8";:root{--bs-font-sans-serif:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue","Noto Sans","Liberation Sans",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--bs-font-monospace:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--bs-body-font-family:var(--bs-font-sans-serif);--bs-body-font-size:1rem;--bs-body-font-weight:400;--bs-body-line-height:1.5;--bs-body-color:#212529;--bs-body-bg:#fff;--bs-secondary-color:rgba(33, 37, 41, 0.75);--bs-secondary-bg:#e9ecef;--bs-tertiary-bg:#f8f9fa;--bs-heading-color:inherit;--bs-link-color-rgb:13,110,253;--bs-link-hover-color-rgb:10,88,202;--bs-code-color:#d63384;--bs-border-width:1px;--bs-border-color:#dee2e6;--bs-border-radius:0.375rem}*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}.h1,.h2,.h3,h1,h2,h3{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2;color:var(--bs-heading-color)}.h1,h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){.h1,h1{font-size:2.5rem}}.h2,h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){.h2,h2{font-size:2rem}}.h3,h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){.h3,h3{font-size:1.75rem}}p{margin-top:0;margin-bottom:1rem}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}strong{font-weight:bolder}a{color:rgba(var(--bs-link-color-rgb),var(--bs-link-opacity,1));text-decoration:underline}a:hover{--bs-link-color-rgb:var(--bs-link-hover-color-rgb)}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,pre{font-family:var(--bs-font-monospace);font-size:1em}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:var(--bs-code-color);word-wrap:break-word}a>code{color:inherit}img,svg{vertical-align:middle}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button{text-transform:none}[role=button]{cursor:pointer}[type=button],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}::file-selector-button{font:inherit;-webkit-appearance:button}output{display:inline-block}[hidden]{display:none!important}.container,.container-fluid,.container-lg{--bs-gutter-x:1.5rem;--bs-gutter-y:0;width:100%;padding-right:calc(var(--bs-gutter-x) * .5);padding-left:calc(var(--bs-gutter-x) * .5);margin-right:auto;margin-left:auto}@media (min-width:576px){.container{max-width:540px}}@media (min-width:768px){.container{max-width:720px}}@media (min-width:992px){.container,.container-lg{max-width:960px}}@media (min-width:1200px){.container,.container-lg{max-width:1140px}}@media (min-width:1400px){.container,.container-lg{max-width:1320px}}:root{}.row{--bs-gutter-x:1.5rem;--bs-gutter-y:0;display:flex;flex-wrap:wrap;margin-top:calc(-1 * var(--bs-gutter-y));margin-right:calc(-.5 * var(--bs-gutter-x));margin-left:calc(-.5 * var(--bs-gutter-x))}.row>*{flex-shrink:0;width:100%;max-width:100%;padding-right:calc(var(--bs-gutter-x) * .5);padding-left:calc(var(--bs-gutter-x) * .5);margin-top:var(--bs-gutter-y)}@media (min-width:768px){.col-md-12{flex:0 0 auto;width:100%}}@media (min-width:992px){.col-lg-4{flex:0 0 auto;width:33.33333333%}.col-lg-6{flex:0 0 auto;width:50%}}@media (min-width:1200px){.col-xl-2{flex:0 0 auto;width:16.66666667%}.col-xl-3{flex:0 0 auto;width:25%}.col-xl-5{flex:0 0 auto;width:41.66666667%}}@media (min-width:1400px){.col-xxl-2{flex:0 0 auto;width:16.66666667%}.col-xxl-6{flex:0 0 auto;width:50%}}.form-control{display:block;width:100%;padding:.375rem .75rem;font-size:1rem;font-weight:400;line-height:1.5;color:var(--bs-body-color);-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:var(--bs-body-bg);background-clip:padding-box;border:var(--bs-border-width) solid var(--bs-border-color);border-radius:var(--bs-border-radius);transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}@media (prefers-reduced-motion:reduce){.form-control{transition:none}}.form-control[type=file]{overflow:hidden}.form-control[type=file]:not(:disabled):not([readonly]){cursor:pointer}.form-control:focus{color:var(--bs-body-color);background-color:var(--bs-body-bg);border-color:#86b7fe;outline:0;box-shadow:0 0 0 .25rem rgba(13,110,253,.25)}.form-control::-webkit-date-and-time-value{min-width:85px;height:1.5em;margin:0}.form-control::-webkit-datetime-edit{display:block;padding:0}.form-control::-moz-placeholder{color:var(--bs-secondary-color);opacity:1}.form-control::placeholder{color:var(--bs-secondary-color);opacity:1}.form-control:disabled{background-color:var(--bs-secondary-bg);opacity:1}.form-control::-webkit-file-upload-button{padding:.375rem .75rem;margin:-.375rem -.75rem;-webkit-margin-end:.75rem;margin-inline-end:.75rem;color:var(--bs-body-color);background-color:var(--bs-tertiary-bg);pointer-events:none;border-color:inherit;border-style:solid;border-width:0;border-inline-end-width:var(--bs-border-width);border-radius:0;-webkit-transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}.form-control::file-selector-button{padding:.375rem .75rem;margin:-.375rem -.75rem;-webkit-margin-end:.75rem;margin-inline-end:.75rem;color:var(--bs-body-color);background-color:var(--bs-tertiary-bg);pointer-events:none;border-color:inherit;border-style:solid;border-width:0;border-inline-end-width:var(--bs-border-width);border-radius:0;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}@media (prefers-reduced-motion:reduce){.form-control::-webkit-file-upload-button{-webkit-transition:none;transition:none}.form-control::file-selector-button{transition:none}}.form-control:hover:not(:disabled):not([readonly])::-webkit-file-upload-button{background-color:var(--bs-secondary-bg)}.form-control:hover:not(:disabled):not([readonly])::file-selector-button{background-color:var(--bs-secondary-bg)}.form-check{display:block;min-height:1.5rem;padding-left:1.5em;margin-bottom:.125rem}.nav{display:flex;flex-wrap:wrap;padding-left:0;margin-bottom:0;list-style:none}.navbar{--bs-navbar-padding-x:0;--bs-navbar-padding-y:0.5rem;position:relative;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;padding:var(--bs-navbar-padding-y) var(--bs-navbar-padding-x)}.navbar>.container,.navbar>.container-fluid,.navbar>.container-lg{display:flex;flex-wrap:inherit;align-items:center;justify-content:space-between}.alert{--bs-alert-bg:transparent;--bs-alert-padding-x:1rem;--bs-alert-padding-y:1rem;--bs-alert-margin-bottom:1rem;--bs-alert-color:inherit;--bs-alert-border-color:transparent;--bs-alert-border:var(--bs-border-width) solid var(--bs-alert-border-color);--bs-alert-border-radius:var(--bs-border-radius);position:relative;padding:var(--bs-alert-padding-y) var(--bs-alert-padding-x);margin-bottom:var(--bs-alert-margin-bottom);color:var(--bs-alert-color);background-color:var(--bs-alert-bg);border:var(--bs-alert-border);border-radius:var(--bs-alert-border-radius)}@keyframes progress-bar-stripes{0%{background-position-x:1rem}}@keyframes spinner-border{to{transform:rotate(360deg)}}@keyframes spinner-grow{0%{transform:scale(0)}50%{opacity:1;transform:none}}.placeholder{display:inline-block;min-height:1em;vertical-align:middle;cursor:wait;background-color:currentcolor;opacity:.5}@keyframes placeholder-glow{50%{opacity:.2}}@keyframes placeholder-wave{100%{-webkit-mask-position:-200% 0;mask-position:-200% 0}}.fixed-top{position:fixed;top:0;right:0;left:0;z-index:1030}.d-flex{display:flex!important}.d-none{display:none!important}.position-relative{position:relative!important}.justify-content-center{justify-content:center!important}.align-items-center{align-items:center!important}.mt-3{margin-top:1rem!important}.me-auto{margin-right:auto!important}.mb-3{margin-bottom:1rem!important}.ps-0{padding-left:0!important}.ps-1{padding-left:.25rem!important}.text-center{text-align:center!important}@font-face{font-family:Poppins;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/poppins/v15/pxiEyp8kv8JHgFVrJJfecg.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Poppins;font-style:normal;font-weight:500;font-display:swap;src:url(https://fonts.gstatic.com/s/poppins/v15/pxiByp8kv8JHgFVrLGT9Z1xlFQ.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Poppins;font-style:normal;font-weight:600;font-display:swap;src:url(https://fonts.gstatic.com/s/poppins/v15/pxiByp8kv8JHgFVrLEj6Z1xlFQ.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Poppins;font-style:normal;font-weight:700;font-display:swap;src:url(https://fonts.gstatic.com/s/poppins/v15/pxiByp8kv8JHgFVrLCz7Z1xlFQ.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Roboto;font-style:italic;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v20/KFOkCnqEu92Fr1Mu51xIIzI.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Roboto;font-style:italic;font-weight:500;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v20/KFOjCnqEu92Fr1Mu51S7ACc6CsQ.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Roboto;font-style:italic;font-weight:700;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v20/KFOjCnqEu92Fr1Mu51TzBic6CsQ.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Roboto;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu4mxK.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Roboto;font-style:normal;font-weight:500;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmEU9fBBc4.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Roboto;font-style:normal;font-weight:700;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmWUlfBBc4.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}body{background:#fff;color:#444;font-family:Roboto,sans-serif}a{color:#023b6d;transition:.3s;text-decoration:none}a:active,a:focus,a:hover{color:#009bd9;outline:0;text-decoration:none}h1,h2,h3{color:#023b6d;font-family:Poppins,sans-serif}.main{margin-top:60px}.icon{width:16px;height:16px}.scroll-top{display:flex;justify-content:center;align-items:center;position:fixed;right:15px;bottom:-15px;visibility:hidden;opacity:0;width:44px;height:44px;background:#009bd9;border-radius:4px;transition:.3s;z-index:11}.scroll-top:hover{background:#03b7ff;box-shadow:0 6px 15px 0 rgba(0,155,217,.3)}.scroll-top .icon{color:#fff;width:20px;height:20px}.scroll-top.active{visibility:visible;opacity:1;transition:.3s;bottom:15px}code{background:#e9e9e9;color:#444;border:1px solid #ddd;border-radius:2px;font-size:12px;padding:4px 8px 4px 8px}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}.header{background:#023b6d;height:60px;z-index:9999}.header .search-form{min-width:240px}.header .search-form input{border:1px solid rgba(255,255,255,.5);background-color:rgba(255,255,255,.05);color:#fff;border-radius:0}.header .search-form input:focus{border-color:rgba(255,255,255,.8)}.header .search-form .icon{color:rgba(255,255,255,.8)}@media (min-width:1280px){.navbar{padding:0;position:static}.navbar ul{margin:0;padding:0;display:flex;list-style:none;align-items:center}.navbar>ul>li{white-space:nowrap;padding:10px 0 10px 25px}.navbar a,.navbar a:focus{display:flex;align-items:center;justify-content:space-between;padding:0 3px;font-size:16px;font-weight:400;color:rgba(255,255,255,.7);white-space:nowrap;transition:.3s;position:relative}.navbar a .icon,.navbar a:focus .icon{width:20px;height:20px;color:#009bd9}.navbar .active,.navbar .active:focus,.navbar a:hover,.navbar li:hover>a{color:#fff}.navbar .nav-categories ul{position:absolute;top:60px;left:12px;right:12px;padding:15px;height:auto;background:#fff;box-shadow:0 5px 15px 0 rgba(2,59,109,.1);opacity:0;visibility:hidden;transition:.2s;flex-wrap:wrap}.navbar .nav-categories ul li{display:flex;flex:0 20%;align-items:center;padding:8px 8px}.navbar .nav-categories ul a{padding:0;color:#023b6d;margin-right:5px;font-size:15px;font-weight:400}.navbar .nav-categories ul a:hover{color:#009bd9}.navbar .nav-categories ul a.active{font-weight:700;color:#009bd9}.navbar .nav-categories ul .icon{color:#009bd9;width:18px;height:18px}.navbar .nav-categories ul span{color:#999;font-size:13px;font-weight:400}.navbar .nav-categories:hover>ul{opacity:1;visibility:visible;transition:.2s}.navbar .memberarea .icon{margin:2px 5px 0 0}.mobile-nav-hide,.mobile-nav-show{display:none}}@media (max-width:1279px){.navbar{position:fixed;top:60px;right:-100%;width:100%;max-width:400px;border-left:1px solid #666;bottom:0;transition:.3s;z-index:9997}.navbar>ul{position:absolute;inset:0;padding:15px 0;margin:0;background:rgba(255,255,255,.9);overflow-y:auto;transition:.3s;z-index:9998;list-style:none;display:flex;flex-direction:column}.navbar a,.navbar a:focus{display:flex;align-items:center;padding:10px 20px;font-size:18px;font-weight:400;color:#023b6d;white-space:nowrap;transition:.3s}.navbar a .icon,.navbar a:focus .icon{width:20px;height:20px;color:#009bd9;margin-left:4px}.navbar .active,.navbar .active:focus,.navbar a:hover,.navbar li:hover>a{color:#009bd9}.navbar .memberarea .icon{margin:2px 6px 0 0}.navbar .nav-search-form{display:none}.navbar .nav-categories{position:relative}.navbar .nav-categories ul{padding:0 15px 0 25px;background:#fff;transition:.2s;display:none}.navbar .nav-categories ul li{display:flex;align-items:center;padding:8px}.navbar .nav-categories ul a{padding:0;color:#023b6d;margin-right:5px;font-size:16px;font-weight:400}.navbar .nav-categories ul a:hover{color:#009bd9}.navbar .nav-categories ul a.active{font-weight:700;color:#009bd9}.navbar .nav-categories ul .icon{color:#009bd9;width:18px;height:18px}.navbar .nav-categories ul span{color:#999;font-size:13px;font-weight:400}.navbar .nav-categories .nav-categories-active{display:block}.mobile-nav-toggle{margin:-4px 15px 0 15px}.mobile-nav-toggle .icon{color:rgba(255,255,255,.7);transition:.5s;z-index:9999;width:24px;height:24px}.mobile-nav-active{overflow:hidden}.mobile-nav-active .navbar{right:0}.mobile-nav-active .navbar:before{content:"";position:fixed;inset:60px 0 0 0;background:rgba(255,255,255,.8);z-index:9996}}@keyframes animate-spinner{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.page-header{padding:50px 0 20px 0;margin-bottom:50px;background:#fff;position:relative}.page-header:after{content:'';position:absolute;display:block;width:60px;height:3px;background:#009bd9;border-right:3px solid #fff;left:calc(50% - 30px);bottom:0}.page-header .page-title{font-size:32px;padding:0;margin:0;color:#023b6d;font-weight:600;background:#fff;font-family:Roboto,sans-serif;text-align:center}.page-content h3{font-size:20px;font-weight:500;color:#009bd9}.members label{padding:5px 0}.search-bar-toggle{color:rgba(255,255,255,.7);width:24px;height:24px;margin-right:5px;cursor:pointer;transition:.3s;display:none}.search-bar-toggle:hover{color:#fff}@media (max-width:1279px){.search-bar-toggle{display:block}}.search-bar{position:fixed;top:60px;left:0;right:0;padding:20px 0;box-shadow:0 0 15px 0 rgba(2,59,109,.1);background:#fff;z-index:9999}.search-form input{border:0;font-size:14px;color:#023b6d;border:1px solid rgba(2,59,109,.2);padding:7px 38px 7px 10px;border-radius:3px;transition:.3s;width:100%}.search-form input:focus,.search-form input:hover{outline:0;box-shadow:0 0 10px 0 rgba(2,59,109,.15);border:1px solid rgba(2,59,109,.3)}.search-form button{border:0;padding:0;margin-left:-30px;background:0 0}.search-form button .icon{color:rgba(2,59,109,.6);width:20px;height:20px}.loading{display:none;background:#fff;text-align:center;padding:15px;margin:0 0 15px 0}.loading:before{content:"";display:inline-block;border-radius:50%;width:24px;height:24px;border:3px solid #18d26e;border-top-color:#eee;animation:animate-loading 1s linear infinite}@keyframes animate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.footer{margin-top:30px}.footer-newsletter{background:#f4faff}.newsletter-form{padding:50px 0;font-size:16px;background:#f4faff;text-align:center}.newsletter-form h3{font-size:24px;margin:0 0 20px 0;padding:0;line-height:1;font-weight:600}.newsletter-form input[type=email]{border:1px solid #fff;padding:10px 12px;width:100%;box-shadow:0 2px 15px rgba(2,59,109,.12);display:block;transition:.3s}.newsletter-form input[type=email]:focus{outline:0;border-color:#009bd9}.newsletter-form input[type=submit]{font-size:16px;padding:12px 40px;border:0;background:#009bd9;color:#fff;transition:.3s;border-radius:3px;box-shadow:0 2px 15px rgba(2,59,109,.12)}.newsletter-form input[type=submit]:hover{background:#00a6e8;box-shadow:0 0 30px rgba(2,59,109,.2)}.newsletter-form .error-message{display:none;color:#fff;background:#ed3c0d;text-align:center;padding:15px;font-weight:600;margin:15px 0 0 0}.newsletter-form .sent-message{display:none;color:#fff;background:#18d26e;text-align:center;padding:15px;font-weight:600;margin:15px 0 0 0}.newsletter-form forms{margin-top:30px;background:#fff;padding:6px 10px;position:relative;border-radius:3px;box-shadow:0 2px 15px rgba(2,59,109,.12);text-align:left}.footer-top{padding:60px 0 30px 0;background:#023b6d;border-top:2px solid #f4faff}.footer-top h3{font-size:16px;font-weight:600;position:relative;padding-bottom:12px;margin-bottom:0;color:#fff}.footer-about{margin-bottom:30px}.footer-about .description{font-size:14px;line-height:24px;margin:10px 0 0 0;color:#fff}.social-links a{background:rgba(255,255,255,.2);color:#fff;margin-right:5px;border-radius:50px;text-align:center;width:40px;height:40px;transition:.3s;display:flex;justify-content:center;align-items:center;cursor:pointer}.social-links a:hover{background:#009bd9;color:#fff;text-decoration:none}.social-links .icon{width:18px;height:18px}.footer-nav{margin-bottom:30px}.footer-nav ul{list-style:none;padding:0;margin:0}.footer-nav .icon{color:#009bd9;width:18px;height:18px;margin:0 2px 0 -5px}.footer-nav li{padding:6px 0;display:flex;align-items:center}.footer-nav li:first-child{padding-top:0}.footer-nav a{transition:.3s;font-size:15px;color:rgba(255,255,255,.7)}.footer-nav a:hover{text-decoration:none;color:#fff}.copyright{font-size:15px;padding:25px 0}.cookie-bar{background-color:rgba(0,0,0,.8);color:#fff;padding:15px;position:fixed;left:0;right:0;bottom:0;display:flex;justify-content:center;align-items:center;font-size:14px;z-index:99999999;transition:bottom 1s;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}.cookie-bar a{color:#fff;text-decoration:underline}.cookie-bar .accept-cookies{background-color:#009bd9;color:#fff;border:0;padding:3px 15px;cursor:pointer;border-radius:3px;transition:none;margin-left:10px}.cookie-bar .accept-cookies:active,.cookie-bar .accept-cookies:hover{background-color:#0089c0}@media (max-width:1024px){.cookie-bar{flex-direction:column}.cookie-bar span{padding-bottom:10px}}</style><link rel="alternate" type="application/rss+xml" title="BootstrapMade &raquo; Feed" href="https://bootstrapmade.com/feed/"><meta name="google-site-verification" content="j6o3lD4O-aaTerWixKmgUxjAA0n4I1JM3O6t82X9KVw"></head><body><header id="header" class="header fixed-top d-flex align-items-center"><div class="container-fluid container-lg d-flex align-items-center position-relative"> <a href="https://bootstrapmade.com/" rel="home" title="Bootstrap Templates | Premium & Free Download" class="me-auto"> <img alt="BootstrapMade" src="https://bootstrapmade.com/assets/img/logo.png" width="214" height="30"> </a><nav id="navbar" class="navbar"><ul><li><a href="https://bootstrapmade.com/" >Home</a></li><li class="nav-categories"><a href="https://bootstrapmade.com/" ><span>Templates</span><svg class="icon icon-chevron-down" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-down"/></svg></a><ul><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-business-templates/" >Business</a> <span>(66)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-education-templates/" >Education</a> <span>(1)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-admin-templates/" >Admin</a> <span>(1)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-coming-soon-templates/" >Coming Soon</a> <span>(3)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-one-page-templates/" >One Page</a> <span>(60)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-landing-page-templates/" >Landing Page</a> <span>(21)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-corporate-templates/" >Corporate</a> <span>(63)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-agency-templates/" >Agency</a> <span>(61)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-photography-website-templates/" >Photography</a> <span>(1)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-portfolio-templates/" >Portfolio</a> <span>(11)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-personal-templates/" >Personal</a> <span>(12)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-resume-cv-templates/" >Resume / CV</a> <span>(10)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-real-estate-templates/" >Real Estate</a> <span>(1)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-health-templates/" >Health</a> <span>(2)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-restaurant-templates/" >Restaurant</a> <span>(3)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-5-templates/" >Bootstrap 5</a> <span>(96)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-4-templates/" >Bootstrap 4</a> <span>(80)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/website-templates/" >Website Templates</a> <span>(38)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/free-website-templates/" >Free Website Templates</a> <span>(40)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-medical-templates/" >Medical</a> <span>(2)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-construction-website-templates/" >Construction</a> <span>(1)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-transportation-website-templates/" >Transportation</a> <span>(1)</span></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-blog-magazine-templates/" >Blog & Magazine</a> <span>(1)</span></li></ul></li><li><a href="https://bootstrapmade.com/bootstrap-template-builder/" >Bootstrap Builder</a></li><li><a href="https://bootstrapmade.com/license/" >License</a></li><li><a href="https://bootstrapmade.com/contact/" >Contact</a></li><li><a href="https://bootstrapmade.com/members/" class="memberarea "><svg class="icon icon-user2" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#user2"/></svg><span>Members</span></a></li><li class="nav-search-form"><form class="search-form d-flex align-items-center ajaxform" data-append="#main" method="POST" action="https://bootstrapmade.com/search/"> <input type="text" value="" name="q" placeholder="Search" title="Enter search keyword"> <button type="submit" title="Search"><svg class="icon icon-search" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#search"/></svg></button></form></li></ul></nav> <svg class="icon icon-search search-bar-toggle" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#search"/></svg> <a href="#" class="mobile-nav-toggle mobile-nav-show" title="Toggle Menu"><svg class="icon icon-menu" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#menu"/></svg></a> <a href="#" class="mobile-nav-toggle mobile-nav-hide d-none" title="Close Menu"><svg class="icon icon-close" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#close"/></svg></a></div></header><main id="main" class="main"><div class="container"><div class="page-header"><h1 class="page-title">PHP Email Form</h1></div><div class="page-content"><p><strong>PHP Email Form</strong> is simple and easy to use PHP script for sending the data submitted by web HTML forms (like contact forms) to your email inbox. The library is created by the BootstrapMade team and available in the paid versions of templates published on BootstrapMade.com. It works out of the box with the included contact forms in our templates.</p><h2>Table of contents</h2><ol style="font-weight: 500; font-size: 18px;"><li><a href="#setting" class="scrollto">Setting up the PHP Email Form as a contact form</a></li><li><a href="#multiple-addresses" class="scrollto">Adding multiple receiving email addresses</a></li><li><a href="#spam-protection" class="scrollto">Spam protection</a></li><li><a href="#add-attachment" class="scrollto">Adding attachment to your form</a></li><li><a href="#accept-terms" class="scrollto">Adding "Accept terms/privacy policy" checkbox to your form</a></li><li><a href="#advanced-usage" class="scrollto">Advanced Usage and Customization of the PHP Email Form</a></li><li><a href="#error-messages" class="scrollto">Customizing the error messages</a></li><li><a href="#requirements" class="scrollto">Requirements</a></li></ol><section id="setting" style="padding-top: 30px;"><h3>1. Setting up the PHP Email Form as a contact form</h3><p>We do provide contact forms in all our templates. The PHP Email Form works out of the box with our contact forms. You just need to configure your receiving email address if you have PHP support on your hosting.</p><ol><li>If you already started working with the free version of the template: Download the pro version from your member area, uzip it and copy the <strong>/assets/vendor/php-email-form/php-email-form.php</strong> to the /<strong>assets/vendor/php-email-form/</strong> folder of your working project.</li><li>Edit <strong>/forms/contact.php</strong> and replace <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f4979b9a80959780b4918c9599849891da979b99">[email&#160;protected]</a> with your email address and you’re done!</li></ol><p>PHP Email Form uses the <a href="https://www.php.net/manual/en/function.mail.php" target="_blank" rel="noopener noreferrer">PHP mail() function</a> for mailing by default. The <strong>/forms/contact.php</strong> also comes with a configuration for SMTP, in case your hosting doesn’t allow sending emails with the PHP mail() function. The SMTP configurations are commented. You need to uncomment the SMTP configuration lines and add your credentials.</p></section><section id="multiple-addresses" style="padding-top: 30px;"><h3>2. Adding multiple receiving email addresses</h3><p>You can also add multiple receiving email addresses for the submitted forms via <strong>cc</strong> and <strong>bcc</strong> methods. Edit and add the below code to your <code>forms/contact.php</code> just before<br>the line <code>echo $contact-&gt;send();</code></p><pre>$contact-&gt;cc = array('<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e38080918680868a958691d2a3869b828e938f86cd808c8e">[email&#160;protected]</a>', '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f59696879096909c839087c7b5908d9498859990db969a98">[email&#160;protected]</a>'); $contact-&gt;bcc = array('<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9af8f9f9e8fff9fff3ecffe8abdaffe2fbf7eaf6ffb4f9f5f7">[email&#160;protected]</a>', '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="aac8c9c9d8cfc9cfc3dccfd898eacfd2cbc7dac6cf84c9c5c7">[email&#160;protected]</a>');</pre></section><section id="spam-protection" style="padding-top: 30px;"><h3>3. Spam protection</h3><p>We use AJAX method of form submission by default which stops most of the spam bots. You can add extra spam protection to your forms by using the below 2 methods.</p><p><strong>1. Spam Protection with honeypot method</strong><br> Honeypot method is a very clever method of spam protection. You just add an extra field to your form, which is hidden for your users and not filled while submitting it. Spam bots fills it thinking that it’s a standard required field and alert us it’s activity. If the honeypot field is filled in, we can confidently reject the form as spam. To use the honeypot method:</p><p>First, edit your form and add an extra filed, e.g:</p><pre>&lt;div class="form-group d-none"&gt; &lt;input type="text" class="form-control" name="first_name"&gt; &lt;div class="validate"&gt;&lt;/div&gt; &lt;/div&gt;</pre><p>Then, edit your <strong>/forms/contact.php</strong> and add the below code just before the line <code>echo $contact-&gt;send();</code></p><pre>$contact-&gt;honeypot = $_POST['first_name'];</pre><p>You can change the filed name <em>first_name</em> as you wish.</p><p><strong>2. Spam Protection with Google reCaptcha</strong><br> Google reCaptcha is the most popular form submission protection in the world. PHP Email Form comes with built in support for the latest version 3.0 of Google reCaptcha. Follow the below steps to enable Google reCaptcha protection for your form.</p><p>1. Go to <a href="https://www.google.com/recaptcha/admin/">Google reCapthca administration</a> website, set-up your website and obtain your keys (site key and secret key)</p><p>2. Add the below line to your web page in the footer part along with the other script inclusions.</p><pre>&lt;script src="https://www.google.com/recaptcha/api.js?render=Your_reCAPTCHA_site_key"&gt;&lt;/script&gt;</pre><p>Replace <em>Your_reCAPTCHA_site_key</em> with the site key you obtained in the step 1</p><p>3. Add <code>data-recaptcha-site-key</code> to your form tag, e.g:</p><pre>&lt;form action="forms/contact.php" method="post" role="form" class="php-email-form" data-recaptcha-site-key="Your_reCAPTCHA_site_key"&gt;</pre><p>Replace <em>Your_reCAPTCHA_site_key</em> with the site key you obtained in the step 1</p><p>4. Edit your <code>/forms/contact.php</code> and add the below code just before the line <code>echo $contact-&gt;send();</code></p><pre>$contact-&gt;recaptcha_secret_key = 'Your_reCAPTCHA_secret_key';</pre><p>Replace <em>Your_reCAPTCHA_secret_key</em> with the secret key you obtained in the step 1</p><p>You’re done. Your form now should be protected with the Google reCaptcha service!</p></section><section id="add-attachment" style="padding-top: 30px;"><h3>4. Adding attachment to your form</h3><p>You can also add a file upload filed to your form. You'll receive the user submitted file as an attachment to your email.</p><p>1. Add a file filed to your form, e.g:</p><pre>&#x3C;div class=&#x22;form-group mt-3&#x22;&#x3E; &#x3C;input class=&#x22;form-control&#x22; type=&#x22;file&#x22; name=&#x22;resume&#x22;&#x3E; &#x3C;/div&#x3E;</pre><p>2. Edit your <code>/forms/contact.php</code> and add the below code just before the line <code>echo $contact-&gt;send();</code></p><pre>$contact-&#x3E;add_attachment(&#x27;resume&#x27;, 20, array(&#x27;pdf&#x27;, &#x27;doc&#x27;, &#x27;docx&#x27;, &#x27;rtf&#x27;));</pre><p>The first value <strong>(resume)</strong> of the add_attachment method is the name of the file field, as set in the step 1.</p><p>The second value <strong>(20)</strong> is the maximum allowed file size in MB</p><p>The third value <strong>array(&#x27;pdf&#x27;, &#x27;doc&#x27;, &#x27;docx&#x27;, &#x27;rtf&#x27;)</strong> is an array of allowed file extensions</p></section><section id="accept-terms" style="padding-top: 30px;"><h3>5. Adding "Accept terms/privacy policy" checkbox to your form</h3><p>Here is an example code in case you need to add a checkbox to your form and require your users to accept your terms or privacy policy before submitting the form.</p><p>First, add the below code to your form, just before the submit button:</p><pre>&lt;div class=&quot;form-check form-group ps-0&quot;&gt; &lt;input id=&quot;privacy-policy&quot; type=&quot;checkbox&quot; name=&quot;privacy&quot; value=&quot;accept&quot; required&gt; &lt;label class=&quot;form-check-label ps-1&quot; for=&quot;privacy-policy&quot;&gt; Accept our &lt;a href=&quot;terms.html&quot;&gt;terms of service&lt;/a&gt; and &lt;a href=&quot;privacy.html&quot;&gt;privacy policy&lt;/a&gt; &lt;/label&gt; &lt;/div&gt;</pre><p>&nbsp;<br> Then, edit your <code>/forms/contact.php</code> and add the below code just before the line <code>echo $contact-&gt;send();</code></p><pre>if($_POST['privacy'] !='accept') { die('Please, accept our terms of service and privacy acy policy'); }</pre></section><section id="advanced-usage" style="padding-top: 30px;"><h3>6 Advanced Usage and Customization of the PHP Email Form</h3><p>The <strong>PHP Email Form</strong> can also be used for emailing any forms with unlimited custom inputs. It also comes with integrated SMTP support that allows you to send emails without a local mail server.</p><p>You can just duplicate the <strong>forms/contact.php</strong> to a new file and use it as a starting point, e.g: myform.php<br> You also need to set the action property to your new form to the newly created myform.php, e.g:<br> <code>&lt;form action="forms/myform.php" method="post" class="php-email-form"&gt;</code></p><p>Below is a full documentation of each line of the <strong>forms/contact.php</strong> and how you can customize them for your needs. First, below is the full content of the contact.php. Scroll down for detailed explanation.</p><pre>&lt;?php /** * Requires the "PHP Email Form" library * The "PHP Email Form" library is available only in the pro version of the template * The library should be uploaded to: vendor/php-email-form/php-email-form.php * For more info and help: https://bootstrapmade.com/php-email-form/ */ // Replace <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9bf8f4f5effaf8efdbfee3faf6ebf7feb5f8f4f6">[email&#160;protected]</a> with your real receiving email address $receiving_email_address = '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dab9b5b4aebbb9ae9abfa2bbb7aab6bff4b9b5b7">[email&#160;protected]</a>'; if( file_exists($php_email_form = '../assets/vendor/php-email-form/php-email-form.php' )) { include( $php_email_form ); } else { die( 'Unable to load the "PHP Email Form" Library!'); } $contact = new PHP_Email_Form; $contact-&gt;ajax = true; $contact-&gt;to = $receiving_email_address; $contact-&gt;from_name = $_POST['name']; $contact-&gt;from_email = $_POST['email']; $contact-&gt;subject = $_POST['subject']; // Uncomment below code if you want to use SMTP to send emails. You need to enter your correct SMTP credentials /* $contact-&gt;smtp = array( 'host' =&gt; 'example.com', 'username' =&gt; 'example', 'password' =&gt; 'pass', 'port' =&gt; '587' ); */ $contact-&gt;add_message( $_POST['name'], 'From'); $contact-&gt;add_message( $_POST['email'], 'Email'); $contact-&gt;add_message( $_POST['message'], 'Message', 10); echo $contact-&gt;send(); ?&gt; </pre><p>&nbsp;</p><pre>// Replace <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b7d4d8d9c3d6d4c3f7d2cfd6dac7dbd299d4d8da">[email&#160;protected]</a> with your real receiving email address $receiving_email_address = '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c9aaa6a7bda8aabd89acb1a8a4b9a5ace7aaa6a4">[email&#160;protected]</a>';</pre><p>Here we set the receiving email address variable, which we will later use when setting up the PHP Email Form class properties. It’s not required to do it this way, we just moved this configuration at the top in the contact.php since it’s the only configuration setting that requires editing for the default contact form.</p><pre>if( file_exists($php_email_form = '../assets/vendor/php-email-form/php-email-form.php' )) { include( $php_email_form ); } else { die( 'Unable to load the "PHP Email Form" Library!'); }</pre><p>Here we check if the PHP Email Form library exists and then include it. The script will end execution if php-email-form.php library file doesn’t exists.</p><pre>$contact = new PHP_Email_Form;</pre><p>Here we initiate the PHP Email Form and assign it to $contact variable. You can change the $contact to your own.</p><pre>$contact-&gt;ajax = true;</pre><p>We use the AJAX method of posting the form in our contact form. This setting checks if the post method is really coming from an AJAX call and outputs error if isn’t. The <code>ajax</code> property is false by default</p><pre>$contact-&gt;to = $receiving_email_address; $contact-&gt;from_name = $_POST['name']; $contact-&gt;from_email = $_POST['email']; $contact-&gt;subject = $_POST['subject'];</pre><p>Al of these four properties <code>to</code> <code>from_name</code> <code>from_email</code> <code>subject</code> are required and need to be set up.</p><p>The <code>to</code> property is the receiving email address of the form. You can set it directly from here as <code>$contact-&gt;to = '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="81e2eeeff5e0e2f5c1e4f9e0ecf1ede4afe2eeec">[email&#160;protected]</a>';</code> or use the $receiving_email_address variable as we do.</p><p>The <code>from_name</code> property is the email sender name. In our contact form we capture the input value with name “name”. You can set it directly from here as <code>$contact-&gt;from_name = 'Custom Name';</code> or other input value with a different name, e.g: <code>$contact-&gt;from_name = $_POST['sender_name'];</code></p><p>The <code>from_email</code> property is the sender email address. In our contact form we capture the input value with name “email”. You can set it directly from here as <code>$contact-&gt;from_email = '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d8bbadabacb7b598bdb5b9b1b4f6bbb7b5">[email&#160;protected]</a>';</code> or other input value with a different name, e.g: <code>$contact-&gt;from_email = $_POST['email_address'];</code></p><p>The <code>subject</code> property is the email subject. In our contact form we capture the input value with name “subject”. You can set it directly from here as <code>$contact-&gt;subject = 'My Subject';</code> or other input value with a different name, e.g: <code>$contact-&gt;subject = $_POST['form_subject'];</code></p><pre>// Uncomment below code if you want to use SMTP to send emails. You need to enter your correct SMTP credentials /* $contact-&gt;smtp = array( 'host' =&gt; 'example.com', 'username' =&gt; 'example', 'password' =&gt; 'pass', 'port' =&gt; '587' ); */</pre><p><strong>PHP Email Form</strong> uses the <a href="https://www.php.net/manual/en/function.mail.php">PHP mail() function</a> for mailing by default. You can use SMTP if your hosting doesn’t support the PHP mail() function or you can prefer the SMPT. To use SMTP, just uncomment the above code and add your credentials.</p><pre>$contact-&gt;add_message( $_POST['name'], 'From'); $contact-&gt;add_message( $_POST['email'], 'Email'); $contact-&gt;add_message( $_POST['message'], 'Message', 10);</pre><p>Here we prepare and compose the message content that will be included in the email body with using the <code>add_message()</code> method, which is a part of PHP Mail Form. It can be used unlimited times based on your needs. As you can see, we use it 3 times in our contact.php. The formatted message that you’ll receive in your email will be as an example below:<br> <strong>Email:</strong> Sender Name<br> <strong>From:</strong> <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7a091f141e1f083a1f171b131654191517">[email&#160;protected]</a><br> <strong>Message:</strong> The message text</p><p><code>add_message()</code> method accepts 3 parameters. The first one is the message text, the second one is a title/label and the third one is length check number (it will output error if the provided message text characters count is under the set length).</p><pre>echo $contact-&gt;send();</pre><p>It will output a text message “OK” if the email is sent successfully or an error message if the email is not sent for some reason.</p></section><section id="error-messages" style="padding-top: 30px;"><h3>7. Customizing the error messages</h3><p>You can also customize the returned error messages by the PHP Email Form. Here are the available error message properties and their default values.</p><pre>$contact-&gt;invalid_to_email = 'Email to (receiving email address) is empty or invalid!'; $contact-&gt;invalid_from_name' = 'From Name is empty!'; $contact-&gt;invalid_from_email' = 'Email from: is empty or invalid!'; $contact-&gt;invalid_subject' = 'Subject is too short or empty!'; $contact-&gt;short' = 'is too short or empty!'; // If the length check number is set and the provided message text is under the set length in the add_message() method call $contact-&gt;ajax_error' = 'Sorry, the request should be an Ajax POST'; // If ajax property is set true and the post method is not an AJAX call</pre></section><section id="requirements" style="padding-top: 30px;"><h3>8. Requirements</h3><p><strong>PHP Email Form</strong> requires at last PHP version 5.5 in your hosting server. Your hosting should allow you to send emails with using the PHP’s <a href="https://www.php.net/manual/en/function.mail.php">mail()</a> function. You can use SMTP method if the mail() function is not supported.</p></section></div></div></main><footer id="footer" class="footer"><div class="footer-newsletter"><div class="container"><div class="row justify-content-center"><div class="col-lg-6"><div class="newsletter-form"><h3>Join Our Newsletter</h3><p>Subscribe to our newsletter to receive emails about new template releases and updates</p><form action="https://bootstrapmade.com/newsletter/subscribe/" method="POST" class="php-email-form" id="newsletter-form"> <input type="hidden" name="source" value="form"> <input type="hidden" name="name" value=""> <input type="email" class="mb-3" name="email" title="Enter your Email address" placeholder="Enter your Email address" required> <input type="submit" value="Subscribe" title="Subscribe"><div class="loading mt-3"></div><div class="error-message"></div><div class="sent-message">Your subscription request has been sent. Please click on the confirmation link that we sent to your Email.</div></form></div></div></div></div></div><div class="footer-top"><div class="container"><div class="row"><div class="col-xxl-6 col-xl-5 col-md-12 footer-about"> <a href="https://bootstrapmade.com/" rel="home" title="Bootstrap Templates | Premium & Free Download" class="logo d-flex align-items-center"> <img alt="BootstrapMade" src="https://bootstrapmade.com/assets/img/logo.png" width="214" height="30"> </a><p class="description"> High quality free Bootstrap website templates. Build your next website with our modern and fully responsive web templates!</p><div class="social-links d-flex mt-3"> <a href="https://twitter.com/BootstrapMade" target="_blank" title="Follow us on Twitter" rel="nofollow external noopener noreferrer"><svg class="icon icon-twitter" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#twitter"/></svg></a> <a href="https://facebook.com/BootstrapMade" target="_blank" title="Follow us on Facebook" rel="nofollow external noopener noreferrer"><svg class="icon icon-facebook" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#facebook"/></svg></a> <a href="https://feeds.feedburner.com/BootstrapMade" target="_blank" title="Subscribe to our RSS feed" rel="nofollow external noopener noreferrer"><svg class="icon icon-rss" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#rss"/></svg></a> <a href="https://bootstrapmade.com/newsletter/" title="Subscribe to our newsletter" ><svg class="icon icon-mail" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#mail"/></svg></a></div></div><div class="col-xl-2 col-lg-4"><h3>Company</h3><nav class="footer-nav"><ul><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/about/">About</a></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/license/">License</a></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/php-email-form/">PHP Email Form</a></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/terms/">Terms of service</a></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/privacy/">Privacy policy</a></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-template-builder/">Bootstrap Builder</a></li></ul></nav></div><div class="col-xl-2 col-lg-4"><h3>Popular Templates</h3><nav class="footer-nav"><ul><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/arsha-free-bootstrap-html-template-corporate/">Arsha</a></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/iportfolio-bootstrap-portfolio-websites-template/">iPortfolio</a></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/onepage-multipurpose-bootstrap-template/">OnePage</a></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/mamba-one-page-bootstrap-template-free/">Mamba</a></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/company-free-html-bootstrap-template/">Company</a></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/free-html-bootstrap-template-my-resume/">MyResume</a></li></ul></nav></div><div class="col-xxl-2 col-xl-3 col-lg-4"><h3>Popular Categories</h3><nav class="footer-nav"><ul><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-5-templates/">Bootstrap 5 Templates</a></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/website-templates/">Website Templates</a></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-one-page-templates/">One Page Template</a></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-portfolio-templates/">Portfolio Templates</a></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/free-website-templates/">Free Website Templates</a></li><li><svg class="icon icon-chevron-right" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#chevron-right"/></svg><a href="https://bootstrapmade.com/bootstrap-business-templates/">Business Templates</a></li></ul></nav></div></div></div></div><div class="container"><div class="copyright text-center"> Copyright &copy; 2025 <a href="https://bootstrapmade.com/">BootstrapMade</a></div></div></footer><div title="Search" class="search-bar d-none"><div class="container"><div class="row justify-content-center"><div class="col-lg-6"><form class="search-form d-flex align-items-center ajaxform" data-append="#main" method="POST" action="https://bootstrapmade.com/search/"> <input type="text" value="" name="q" placeholder="Search" title="Enter search keyword"> <button type="submit" title="Search"><svg class="icon icon-search" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#search"/></svg></button></form></div></div></div></div> <a href="#" class="scroll-top" title="Back to top"><svg class="icon icon-arrow-up" fill="currentColor"><use xlink:href="https://bootstrapmade.com/assets/img/icons.svg#arrow-up"/></svg></a> <script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script><script src="https://bootstrapmade.com/assets/js/main.js?v=42"></script> <script async src="https://www.googletagmanager.com/gtag/js?id=G-P7JSYB1CSP"></script> <script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-P7JSYB1CSP');</script> </body></html>

Pages: 1 2 3 4 5 6 7 8 9 10