{"id":426,"date":"2015-03-07T14:08:58","date_gmt":"2015-03-07T17:08:58","guid":{"rendered":"http:\/\/www.valuehost.com.br\/blog\/?p=426"},"modified":"2020-03-23T18:25:49","modified_gmt":"2020-03-23T21:25:49","slug":"como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer","status":"publish","type":"post","link":"https:\/\/www.valuehost.com.br\/blog\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\/","title":{"rendered":"Como fazer formul\u00e1rios PHP enviando e-mail com o PHPMailer"},"content":{"rendered":"<p>No artigo de hoje mostraremos como \u00e9 f\u00e1cil fazer (ou utilizar) um script PHP para o envio seguro de dados dos seus formul\u00e1rios, al\u00e9m de permitir autentica\u00e7\u00e3o ao servidor SMTP e ter uma maior chance das mensagens chegarem aos seus destinat\u00e1rios diretamente na caixa de entrada.<\/p>\n<p>\u00c9 comum observarmos casos de \u201cinvas\u00f5es\u201d a formul\u00e1rios comuns que utilizam a fun\u00e7\u00e3o mail() sem autentica\u00e7\u00e3o, o que acabam comprometendo n\u00e3o apenas o servidor, como tamb\u00e9m culminam no bloqueio\/suspens\u00e3o da conta de hospedagem.<\/p>\n<p><!--more--><\/p>\n<p>[rock-convert-cta id=&#8221;4211&#8243;]<\/p>\n<h2>O que \u00e9 o PHPMailer?<\/h2>\n<p>Basicamente \u00e9 uma classe do PHP que possui fun\u00e7\u00f5es mais avan\u00e7adas que a classe mail() padr\u00e3o. Um dos seus diferenciais \u00e9 permitir o envio seguro, principalmente a servidores que tenham requerimento por autentica\u00e7\u00e3o. A classe faz a autentica\u00e7\u00e3o do usu\u00e1rio\/senha do SMTP no servidor e garante que aquele e-mail est\u00e1 sendo enviado realmente pela conta autenticada. No uso da fun\u00e7\u00e3o mail() padr\u00e3o, n\u00e3o h\u00e1 autentica\u00e7\u00e3o, por isso os servidores podem rejeitar o recebimento destas mensagens \u2013 e \u00e9 o que acontece em grandes provedores.<\/p>\n<h2>Como us\u00e1-lo?<\/h2>\n<p>Criei um script funcional para voc\u00ea, com um formul\u00e1rio em HTML que faz o envio das diretivas para o arquivo \u201cenviar.php\u201d, que inclui as fun\u00e7\u00f5es contidas em \u201cphpmailer.php\u201d. Ent\u00e3o, \u00e9 uma estrutura com tr\u00eas arquivos, sendo eles:<\/p>\n<p><strong>formulario.html<\/strong>: \u00c9 ele o respons\u00e1vel pelos campos do formul\u00e1rio e faz o envio das vari\u00e1veis para o arquivo envia.php<\/p>\n<p><strong>envia.php<\/strong>: Processa as vari\u00e1veis transportadas via POST do formul\u00e1rio e ativa as diretivas do phpmailer.php<\/p>\n<p><strong>phpmailer.php<\/strong>: Cont\u00e9m as orienta\u00e7\u00f5es do PHP para, al\u00e9m de autenticar o disparo, incluir todas as linhas requeridas do header para um e-mail seguro.<\/p>\n<h2>Eis ent\u00e3o os c\u00f3digos:<\/h2>\n<p>Eu deixei todos os arquivos comentados para ficar ainda mais f\u00e1cil de se editar. Basicamente, o \u00fanico arquio que requer altera\u00e7\u00f5es (al\u00e9m do formulario.html que voc\u00ea pode personalizar com CSS do jeito que preferir) \u00e9 o envia.php, onde voc\u00ea colocar\u00e1 o seu usu\u00e1rio de acesso para autentica\u00e7\u00e3o do SMTP, sua senha e o endere\u00e7o de destino, para onde as mensagens do formul\u00e1rio ser\u00e3o enviadas. Al\u00e9m disto, edite tamb\u00e9m o caminho onde o formul\u00e1rio \u00e9 acessado e, por fim, o endere\u00e7o da sua p\u00e1gina.<\/p>\n<p>formulario.php:<\/p>\n<p>[code lang=&#8221;php&#8221;]&lt;!DOCTYPE html PUBLIC &#8220;-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN&#8221; &#8220;http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd&#8221;&gt;<br \/>\n&lt;html xmlns=&#8221;http:\/\/www.w3.org\/1999\/xhtml&#8221;&gt;<br \/>\n&lt;head&gt;<br \/>\n&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text\/html; charset=utf-8&#8243; \/&gt;<br \/>\n&lt;title&gt;Formul\u00e1rio de Contato&lt;\/title&gt;<br \/>\n&lt;style type=&#8221;text\/css&#8221;&gt;<br \/>\n#contato {<br \/>\nfont-family: Arial, Helvetica, sans-serif;<br \/>\n}<\/p>\n<p>#contato input, #contato textarea {<br \/>\nfont-family: Arial, Helvetica, sans-serif;<br \/>\npadding: 5px;<br \/>\nwidth: 250px;<br \/>\n}<br \/>\n&lt;\/style&gt;<br \/>\n&lt;\/head&gt;<\/p>\n<p>&lt;body&gt;<br \/>\n&lt;form action=&#8221;envia.php&#8221; method=&#8221;post&#8221; id=&#8221;contato&#8221;&gt;<br \/>\n&lt;fieldset&gt;<br \/>\n&lt;legend&gt;Formul\u00e1rio de Contato&lt;\/legend&gt;<\/p>\n<p>&lt;label&gt;Seu nome:&lt;\/label&gt;&lt;br \/&gt;<br \/>\n&lt;input name=&#8221;nome&#8221; type=&#8221;text&#8221; \/&gt;&lt;br \/&gt;&lt;br \/&gt;<\/p>\n<p>&lt;label&gt;Seu email:&lt;\/label&gt;&lt;br \/&gt;<br \/>\n&lt;input name=&#8221;email&#8221; type=&#8221;text&#8221; \/&gt;&lt;br \/&gt;&lt;br \/&gt;<\/p>\n<p>&lt;label&gt;Assunto:&lt;\/label&gt;&lt;br \/&gt;<br \/>\n&lt;input name=&#8221;assunto&#8221; type=&#8221;text&#8221; \/&gt;&lt;br \/&gt;&lt;br \/&gt;<\/p>\n<p>&lt;label&gt;Mensagem:&lt;\/label&gt;&lt;br \/&gt;<br \/>\n&lt;textarea name=&#8221;mensagem&#8221; rows=&#8221;10&#8243;&gt;&lt;\/textarea&gt;&lt;br \/&gt;&lt;br \/&gt;<\/p>\n<p>&lt;input name=&#8221;submit&#8221; type=&#8221;submit&#8221; value=&#8221;Enviar&#8221; style=&#8221;width: auto;&#8221; \/&gt;<br \/>\n&lt;\/fieldset&gt;<br \/>\n&lt;\/form&gt;<br \/>\n&lt;\/body&gt;<br \/>\n&lt;\/html&gt;[\/code]<\/p>\n<p>envia.php<\/p>\n<p>[code lang=&#8221;php&#8221;]&lt;?php<\/p>\n<p>include_once(&#8216;phpmailer.php&#8217;); \/\/Chama o arquivo phpmailer.php com as fun\u00e7\u00f5es para realizar o envio.<\/p>\n<p>\/\/#########################################<br \/>\n\/\/ Recebe as informa\u00e7\u00f5es do formul\u00e1rio<br \/>\n\/\/#########################################<\/p>\n<p>$nome = $_POST[&#8216;nome&#8217;];<br \/>\n$email = $_POST[&#8216;email&#8217;];<br \/>\n$assunto = $_POST[&#8216;assunto&#8217;];<br \/>\n$mensagem = $_POST[&#8216;mensagem&#8217;];<\/p>\n<p>\/\/#########################################<br \/>\n\/\/ Dados da conta de e-mail que far\u00e1 o envio<br \/>\n\/\/#########################################<\/p>\n<p>$smtp = new Smtp(&#8220;localhost&#8221;); \/\/Endere\u00e7o do SMTP, geralmente localhost.<br \/>\n$smtp-&gt;user = &#8220;seuemail@provedor.com.br&#8221;; \/\/Conta de email<br \/>\n$smtp-&gt;pass = &#8220;suasenha&#8221;; \/\/Senha da Conta de e-mail.<br \/>\n$smtp-&gt;debug = false; \/\/Somente para usu\u00e1rios avan\u00e7ados que desejam o log do envio para testes.<\/p>\n<p>\/\/#########################################<br \/>\n\/\/ Envio do formul\u00e1rio<br \/>\n\/\/#########################################<\/p>\n<p>$to = &#8220;email@destino.com.br&#8221;; \/\/Informe aqui o e-mail que deve receber a mensagem do formul\u00e1rio.<br \/>\n$from = $email;<br \/>\n$subject = &#8220;Contato &#8211; &#8221; . $assunto;<br \/>\n$msg = $mensagem;<\/p>\n<p>if (isset($_POST[&#8216;submit&#8217;])) {<br \/>\nif($nome &amp;&amp; $email &amp;&amp; $assunto &amp;&amp; $mensagem) {<br \/>\nif($smtp-&gt;Send($to, $from, $subject, $msg)){<br \/>\necho &#8220;&lt;script&gt;alert(&#8216;Contato enviado!&#8217;);&lt;\/script&gt;&#8221;;<br \/>\necho &#8220;&lt;script&gt;window.location = &#8216;index.php&#8217;;&lt;\/script&gt;&#8221;; \/\/Altere aqui para o endere\u00e7o de sua p\u00e1gina.<br \/>\nexit;<br \/>\n}<br \/>\n}<\/p>\n<p>else {<br \/>\necho &#8220;&lt;script&gt;alert(&#8216;Preencha todos os campos!&#8217;);&lt;\/script&gt;&#8221;;<br \/>\necho &#8220;&lt;script&gt;window.location = &#8216;formulario.html&#8217;;&lt;\/script&gt;&#8221;; \/\/Altere aqui para o endere\u00e7o de seu formul\u00e1rio<br \/>\nexit;<br \/>\n}<\/p>\n<p>}<\/p>\n<p>?&gt;[\/code]<\/p>\n<p>phpmailer.php<\/p>\n<p>[code lang=&#8221;php&#8221;]&lt;?php<\/p>\n<p>class Smtp{<\/p>\n<p>var $conn;<br \/>\nvar $user;<br \/>\nvar $pass;<br \/>\nvar $debug = false;<\/p>\n<p>function Smtp($host){<br \/>\n$this-&gt;conn = fsockopen($host, 25, $errno, $errstr, 30);<br \/>\n$this-&gt;Put(&#8220;EHLO $host&#8221;);<br \/>\n}<br \/>\nfunction Auth(){<br \/>\n$this-&gt;Put(&#8220;AUTH LOGIN&#8221;);<br \/>\n$this-&gt;Put(base64_encode($this-&gt;user));<br \/>\n$this-&gt;Put(base64_encode($this-&gt;pass));<br \/>\n}<br \/>\nfunction Send($to, $from, $subject, $msg){<\/p>\n<p>$this-&gt;Auth();<br \/>\n$this-&gt;Put(&#8220;MAIL FROM: &#8221; . $from);<br \/>\n$this-&gt;Put(&#8220;RCPT TO: &#8221; . $to);<br \/>\n$this-&gt;Put(&#8220;DATA&#8221;);<br \/>\n$this-&gt;Put($this-&gt;toHeader($to, $from, $subject));<br \/>\n$this-&gt;Put(&#8220;\\r\\n&#8221;);<br \/>\n$this-&gt;Put($msg);<br \/>\n$this-&gt;Put(&#8220;.&#8221;);<br \/>\n$this-&gt;Close();<br \/>\nif(isset($this-&gt;conn)){<br \/>\nreturn true;<br \/>\n}else{<br \/>\nreturn false;<br \/>\n}<br \/>\n}<br \/>\nfunction Put($value){<br \/>\nreturn fputs($this-&gt;conn, $value . &#8220;\\r\\n&#8221;);<br \/>\n}<br \/>\nfunction toHeader($to, $from, $subject){<br \/>\n$header = &#8220;Message-Id: &lt;&#8220;. date(&#8216;YmdHis&#8217;).&#8221;.&#8221;. md5(microtime()).&#8221;.&#8221;. strtoupper($from) .&#8221;&gt; \\r\\n&#8221;;<br \/>\n$header .= &#8220;From: &lt;&#8221; . $from . &#8220;&gt; \\r\\n&#8221;;<br \/>\n$header .= &#8220;To: &lt;&#8220;.$to.&#8221;&gt; \\r\\n&#8221;;<br \/>\n$header .= &#8220;Subject: &#8220;.$subject.&#8221; \\r\\n&#8221;;<br \/>\n$header .= &#8220;Date: &#8220;. date(&#8216;D, d M Y H:i:s O&#8217;) .&#8221; \\r\\n&#8221;;<br \/>\n$header .= &#8220;X-MSMail-Priority: High \\r\\n&#8221;;<br \/>\nreturn $header;<br \/>\n}<br \/>\nfunction Close(){<br \/>\n$this-&gt;Put(&#8220;QUIT&#8221;);<br \/>\nif($this-&gt;debug == true){<br \/>\nwhile (!feof ($this-&gt;conn)) {<br \/>\necho fgets($this-&gt;conn) . &#8220;&lt;br&gt;\\n&#8221;;<br \/>\n}<br \/>\n}<br \/>\nreturn fclose($this-&gt;conn);<br \/>\n}<br \/>\n}<\/p>\n<p>?&gt;[\/code]<\/p>\n<p><script type=\"text\/javascript\" src=\"\/\/marketing.valuehost.com.br\/form\/generate.js?id=3\"><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>No artigo de hoje mostraremos como \u00e9 f\u00e1cil fazer (ou utilizar) um script PHP para o envio seguro de dados dos seus formul\u00e1rios, al\u00e9m de permitir autentica\u00e7\u00e3o ao servidor SMTP e ter uma maior chance das mensagens chegarem aos seus destinat\u00e1rios diretamente na caixa de entrada. \u00c9 comum observarmos casos de \u201cinvas\u00f5es\u201d a formul\u00e1rios comuns<\/p>\n","protected":false},"author":1,"featured_media":512,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"amp_status":"","footnotes":""},"categories":[72,191],"tags":[194,192,193],"class_list":{"0":"post-426","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-desenvolvimento","8":"category-php","9":"tag-formulario","10":"tag-php","11":"tag-phpmailer"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Como fazer formul\u00e1rios PHP enviando e-mail com o PHPMailer - Blog da ValueHost<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.valuehost.com.br\/blog\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Como fazer formul\u00e1rios PHP enviando e-mail com o PHPMailer - Blog da ValueHost\" \/>\n<meta property=\"og:description\" content=\"No artigo de hoje mostraremos como \u00e9 f\u00e1cil fazer (ou utilizar) um script PHP para o envio seguro de dados dos seus formul\u00e1rios, al\u00e9m de permitir autentica\u00e7\u00e3o ao servidor SMTP e ter uma maior chance das mensagens chegarem aos seus destinat\u00e1rios diretamente na caixa de entrada. \u00c9 comum observarmos casos de \u201cinvas\u00f5es\u201d a formul\u00e1rios comuns\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.valuehost.com.br\/blog\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog da ValueHost\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/facebook.com\/valuehostbrasil\" \/>\n<meta property=\"article:published_time\" content=\"2015-03-07T17:08:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-03-23T21:25:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.valuehost.com.br\/blog\/wp-content\/uploads\/2015\/03\/php.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"831\" \/>\n\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Administrador\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@valuehostbrasil\" \/>\n<meta name=\"twitter:site\" content=\"@valuehostbrasil\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"Administrador\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. tempo de leitura\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\\\/\"},\"author\":{\"name\":\"Administrador\",\"@id\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/#\\\/schema\\\/person\\\/6c5c2bfdf39886e117506864a00c479d\"},\"headline\":\"Como fazer formul\u00e1rios PHP enviando e-mail com o PHPMailer\",\"datePublished\":\"2015-03-07T17:08:58+00:00\",\"dateModified\":\"2020-03-23T21:25:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\\\/\"},\"wordCount\":1082,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/03\\\/php.jpg\",\"keywords\":[\"formulario\",\"php\",\"phpmailer\"],\"articleSection\":[\"Desenvolvimento\",\"PHP\"],\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\\\/\",\"url\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\\\/\",\"name\":\"Como fazer formul\u00e1rios PHP enviando e-mail com o PHPMailer - Blog da ValueHost\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/03\\\/php.jpg\",\"datePublished\":\"2015-03-07T17:08:58+00:00\",\"dateModified\":\"2020-03-23T21:25:49+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\\\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/03\\\/php.jpg\",\"contentUrl\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/03\\\/php.jpg\",\"width\":831,\"height\":350},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"In\u00edcio\",\"item\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Como fazer formul\u00e1rios PHP enviando e-mail com o PHPMailer\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/\",\"name\":\"Blog da ValueHost\",\"description\":\"Artigos sobre Hospedagem, Revenda, Linux, VPS, Cloud, Dedicado, Dom\u00ednio, Certificado SSL, Backup, WebDesign, SEO,  Shell, etc\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/#organization\",\"name\":\"ValueHost Hospedagem\",\"url\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/05\\\/logo_valuehost_1024x1024.png\",\"contentUrl\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/05\\\/logo_valuehost_1024x1024.png\",\"width\":1024,\"height\":1024,\"caption\":\"ValueHost Hospedagem\"},\"image\":{\"@id\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/facebook.com\\\/valuehostbrasil\",\"https:\\\/\\\/x.com\\\/valuehostbrasil\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/#\\\/schema\\\/person\\\/6c5c2bfdf39886e117506864a00c479d\",\"name\":\"Administrador\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/47637a7862f0e39b85e0eaec84ccb39582621378c11b72dc4318f9ca26ad4ff0?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/47637a7862f0e39b85e0eaec84ccb39582621378c11b72dc4318f9ca26ad4ff0?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/47637a7862f0e39b85e0eaec84ccb39582621378c11b72dc4318f9ca26ad4ff0?s=96&d=mm&r=g\",\"caption\":\"Administrador\"},\"url\":\"https:\\\/\\\/www.valuehost.com.br\\\/blog\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Como fazer formul\u00e1rios PHP enviando e-mail com o PHPMailer - Blog da ValueHost","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.valuehost.com.br\/blog\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\/","og_locale":"pt_BR","og_type":"article","og_title":"Como fazer formul\u00e1rios PHP enviando e-mail com o PHPMailer - Blog da ValueHost","og_description":"No artigo de hoje mostraremos como \u00e9 f\u00e1cil fazer (ou utilizar) um script PHP para o envio seguro de dados dos seus formul\u00e1rios, al\u00e9m de permitir autentica\u00e7\u00e3o ao servidor SMTP e ter uma maior chance das mensagens chegarem aos seus destinat\u00e1rios diretamente na caixa de entrada. \u00c9 comum observarmos casos de \u201cinvas\u00f5es\u201d a formul\u00e1rios comuns","og_url":"https:\/\/www.valuehost.com.br\/blog\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\/","og_site_name":"Blog da ValueHost","article_publisher":"https:\/\/facebook.com\/valuehostbrasil","article_published_time":"2015-03-07T17:08:58+00:00","article_modified_time":"2020-03-23T21:25:49+00:00","og_image":[{"width":831,"height":350,"url":"https:\/\/www.valuehost.com.br\/blog\/wp-content\/uploads\/2015\/03\/php.jpg","type":"image\/jpeg"}],"author":"Administrador","twitter_card":"summary_large_image","twitter_creator":"@valuehostbrasil","twitter_site":"@valuehostbrasil","twitter_misc":{"Escrito por":"Administrador","Est. tempo de leitura":"5 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.valuehost.com.br\/blog\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\/#article","isPartOf":{"@id":"https:\/\/www.valuehost.com.br\/blog\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\/"},"author":{"name":"Administrador","@id":"https:\/\/www.valuehost.com.br\/blog\/#\/schema\/person\/6c5c2bfdf39886e117506864a00c479d"},"headline":"Como fazer formul\u00e1rios PHP enviando e-mail com o PHPMailer","datePublished":"2015-03-07T17:08:58+00:00","dateModified":"2020-03-23T21:25:49+00:00","mainEntityOfPage":{"@id":"https:\/\/www.valuehost.com.br\/blog\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\/"},"wordCount":1082,"commentCount":0,"publisher":{"@id":"https:\/\/www.valuehost.com.br\/blog\/#organization"},"image":{"@id":"https:\/\/www.valuehost.com.br\/blog\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\/#primaryimage"},"thumbnailUrl":"https:\/\/www.valuehost.com.br\/blog\/wp-content\/uploads\/2015\/03\/php.jpg","keywords":["formulario","php","phpmailer"],"articleSection":["Desenvolvimento","PHP"],"inLanguage":"pt-BR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.valuehost.com.br\/blog\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.valuehost.com.br\/blog\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\/","url":"https:\/\/www.valuehost.com.br\/blog\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\/","name":"Como fazer formul\u00e1rios PHP enviando e-mail com o PHPMailer - Blog da ValueHost","isPartOf":{"@id":"https:\/\/www.valuehost.com.br\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.valuehost.com.br\/blog\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\/#primaryimage"},"image":{"@id":"https:\/\/www.valuehost.com.br\/blog\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\/#primaryimage"},"thumbnailUrl":"https:\/\/www.valuehost.com.br\/blog\/wp-content\/uploads\/2015\/03\/php.jpg","datePublished":"2015-03-07T17:08:58+00:00","dateModified":"2020-03-23T21:25:49+00:00","breadcrumb":{"@id":"https:\/\/www.valuehost.com.br\/blog\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.valuehost.com.br\/blog\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\/"]}]},{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.valuehost.com.br\/blog\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\/#primaryimage","url":"https:\/\/www.valuehost.com.br\/blog\/wp-content\/uploads\/2015\/03\/php.jpg","contentUrl":"https:\/\/www.valuehost.com.br\/blog\/wp-content\/uploads\/2015\/03\/php.jpg","width":831,"height":350},{"@type":"BreadcrumbList","@id":"https:\/\/www.valuehost.com.br\/blog\/como-fazer-formularios-php-enviando-e-mail-com-o-phpmailer\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"In\u00edcio","item":"https:\/\/www.valuehost.com.br\/blog\/"},{"@type":"ListItem","position":2,"name":"Como fazer formul\u00e1rios PHP enviando e-mail com o PHPMailer"}]},{"@type":"WebSite","@id":"https:\/\/www.valuehost.com.br\/blog\/#website","url":"https:\/\/www.valuehost.com.br\/blog\/","name":"Blog da ValueHost","description":"Artigos sobre Hospedagem, Revenda, Linux, VPS, Cloud, Dedicado, Dom\u00ednio, Certificado SSL, Backup, WebDesign, SEO, Shell, etc","publisher":{"@id":"https:\/\/www.valuehost.com.br\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.valuehost.com.br\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-BR"},{"@type":"Organization","@id":"https:\/\/www.valuehost.com.br\/blog\/#organization","name":"ValueHost Hospedagem","url":"https:\/\/www.valuehost.com.br\/blog\/","logo":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.valuehost.com.br\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.valuehost.com.br\/blog\/wp-content\/uploads\/2015\/05\/logo_valuehost_1024x1024.png","contentUrl":"https:\/\/www.valuehost.com.br\/blog\/wp-content\/uploads\/2015\/05\/logo_valuehost_1024x1024.png","width":1024,"height":1024,"caption":"ValueHost Hospedagem"},"image":{"@id":"https:\/\/www.valuehost.com.br\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/facebook.com\/valuehostbrasil","https:\/\/x.com\/valuehostbrasil"]},{"@type":"Person","@id":"https:\/\/www.valuehost.com.br\/blog\/#\/schema\/person\/6c5c2bfdf39886e117506864a00c479d","name":"Administrador","image":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/secure.gravatar.com\/avatar\/47637a7862f0e39b85e0eaec84ccb39582621378c11b72dc4318f9ca26ad4ff0?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/47637a7862f0e39b85e0eaec84ccb39582621378c11b72dc4318f9ca26ad4ff0?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/47637a7862f0e39b85e0eaec84ccb39582621378c11b72dc4318f9ca26ad4ff0?s=96&d=mm&r=g","caption":"Administrador"},"url":"https:\/\/www.valuehost.com.br\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.valuehost.com.br\/blog\/wp-json\/wp\/v2\/posts\/426","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.valuehost.com.br\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.valuehost.com.br\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.valuehost.com.br\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.valuehost.com.br\/blog\/wp-json\/wp\/v2\/comments?post=426"}],"version-history":[{"count":0,"href":"https:\/\/www.valuehost.com.br\/blog\/wp-json\/wp\/v2\/posts\/426\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.valuehost.com.br\/blog\/wp-json\/wp\/v2\/media\/512"}],"wp:attachment":[{"href":"https:\/\/www.valuehost.com.br\/blog\/wp-json\/wp\/v2\/media?parent=426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.valuehost.com.br\/blog\/wp-json\/wp\/v2\/categories?post=426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.valuehost.com.br\/blog\/wp-json\/wp\/v2\/tags?post=426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}