Bom dia! tenho o seguinte código javascript:
function sendEmail() {
document.getElementById("sendFormFran").disabled = true;
let nome = document.getElementById("nome").value.trim();
let endereco = document.getElementById("endereco").value.trim();
let cidade = document.getElementById("cidade").value.trim();
let estado = document.getElementById("estado").value.trim();
let cnpj = document.getElementById("cnpj").value.trim();
let phone1 = document.getElementById("phone1").value.trim();
let phone2 = document.getElementById("phone2").value.trim();
let work = document.getElementById("work").value.trim();
let email = document.getElementById("email").value.trim();
let interessado = {
'nome': nome,
'endereco': endereco,
'cidade': cidade,
'estado': estado,
'cnpj': cnpj,
'phone1': phone1,
'phone2': phone2,
'work': work,
'email': email
}
Gostaria de saber como envio para o php essas informações para poder enviar meu e-mail.
sendMailEvento:
<?php
require "phpmailer/class.phpmailer.php";
function send_email_client($email){
$body = "<table border='0' cellpadding='10' cellspacing='0' style=
'background-color: #FFFFFF' width='100%'>
<tr>
<td>
<table width='600' align='center' cellpadding='0' cellspacing='0' border='0'>
<tr>
<td>
<table align='center' border='0' cellpadding='0' cellspacing='0' class=
'content' style='background-color: #FFFFFF'>
<tr>
<td id='templateContainerHeader' valign='top' mc:edit='welcomeEdit-01'>
<p style='text-align:center;margin:0;padding:0;'>
<img src='http://www.redecomprecerto.com.br/img/logo.png' style='display:inline-block;'>
</p>
</td>
</tr>
<tr>
<td align='center' valign='top'>
<table border='0' cellpadding='0' cellspacing='0' class=
'brdBottomPadd-two' id='templateContainer' width='100%'>
<tr>
<td class='bodyContent' valign='top' mc:edit='welcomeEdit-02'>
<h3 style='text-align: center;'><strong>Obrigado por entrar em contato com a Compre Certo Rede de Drogarias.</strong></h3>
<h3 style='text-align: center;'><strong>Em breve retornaremos o seu contato!</strong></h3>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align='center'>
<table border='0' cellpadding='0' cellspacing='0' class='brdBottomPadd-two ' id='templateContainerMiddle' width='100%'>
<tr valign='top'>
<td align='center' class='bodyContentTicks'>
<table border='0' cellpadding='0' cellspacing='0' width='100%'>
<tr valign='top'>
<h3 style='text-align: center;'>
<a href='https://www.youtube.com/watch?v=gBkgltm0Jao&feature=youtu.be'>
Clique aqui e veja as vantagens de se tornar uma franquia da Compre Certo Rede de Drogarias!
</a>
</h3>
<td valign='top' style='width:5%;'> </td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
</tr>
<tr>
</tr>
</table><!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
</table>
<style type='text/css'>
span.preheader {
display:none!important
}
td ul li {
font-size: 16px;
}
/* /\/\/\/\/\/\/\/\/ CLIENT-SPECIFIC STYLES /\/\/\/\/\/\/\/\/ */
#outlook a {
padding:0
}
/* Force Outlook to provide a 'view in browser' message */
.ReadMsgBody {
width:100%
}
.ExternalClass {
width:100%
}
/* Force Hotmail to display emails at full width */
.ExternalClass,.ExternalClass p,.ExternalClass span,.ExternalClass font,.ExternalClass td,.ExternalClass div {
line-height:100%
}
/* Force Hotmail to display normal line spacing */
body,table,td,p,a,li,blockquote {
-webkit-text-size-adjust:100%;
-ms-text-size-adjust:100%
}
/* Prevent WebKit and Windows mobile changing default text sizes */
table,td {
mso-table-lspace:0;
mso-table-rspace:0
}
/* Remove spacing between tables in Outlook 2007 and up */
/* /\/\/\/\/\/\/\/\/ RESET STYLES /\/\/\/\/\/\/\/\/ */
body {
margin:0;
padding:0
}
img {
max-width:100%;
border:0;
line-height:100%;
outline:none;
text-decoration:none
}
table {
border-collapse:collapse!important
}
.content {
width:100%;
max-width:600px
}
.content img {
height:auto;
min-height:1px
}
#bodyTable {
margin:0;
padding:0;
width:100%!important
}
#bodyCell {
margin:0;
padding:0
}
#bodyCellFooter {
margin:0;
padding:0;
width:100%!important;
padding-top:39px;
padding-bottom:15px
}
body {
margin:0;
padding:0;
min-width:100%!important
}
#templateContainerHeader {
font-size:14px;
padding-top:2.429em;
padding-bottom:.929em
}
#templateContainerFootBrd {
border-bottom:1px solid #e2e2e2;
border-left:1px solid #e2e2e2;
border-right:1px solid #e2e2e2;
border-radius:0 0 4px 4px;
background-clip:padding-box;
border-spacing:0;
height:10px;
width:100%!important
}
#templateContainer {
border-top:1px solid #e2e2e2;
border-left:1px solid #e2e2e2;
border-right:1px solid #e2e2e2;
border-radius:4px 4px 0 0;
background-clip:padding-box;
border-spacing:0
}
#templateContainerMiddle {
border-left:1px solid #e2e2e2;
border-right:1px solid #e2e2e2
}
#templateContainerMiddleBtm {
border-left:1px solid #e2e2e2;
border-right:1px solid #e2e2e2;
border-bottom:1px solid #e2e2e2;
border-radius:0 0 4px 4px;
background-clip:padding-box;
border-spacing:0
}
#templateContainerMiddleBtm .bodyContent {
padding-bottom:2em
}
/**
* @tab Page
* @section heading 1
* @tip Set the styling for all first-level headings in your emails. These should be the largest of your headings.
* @style heading 1
*/
h1 {
color:#2e2e2e;
display:block;
font-family:Helvetica;
font-size:26px;
line-height:1.385em;
font-style:normal;
font-weight:400;
letter-spacing:normal;
margin-top:0;
margin-right:0;
margin-bottom:15px;
margin-left:0;
text-align:left
}
/**
* @tab Page
* @section heading 2
* @tip Set the styling for all second-level headings in your emails.
* @style heading 2
*/
h2 {
color:#2e2e2e;
display:block;
font-family:Helvetica;
font-size:22px;
line-height:1.455em;
font-style:normal;
font-weight:400;
letter-spacing:normal;
margin-top:0;
margin-right:0;
margin-bottom:15px;
margin-left:0;
text-align:left
}
/**
* @tab Page
* @section heading 3
* @tip Set the styling for all third-level headings in your emails.
* @style heading 3
*/
h3 {
color:#545454;
display:block;
font-family:Helvetica;
font-size:18px;
line-height:1.444em;
font-style:normal;
font-weight:400;
letter-spacing:normal;
margin-top:0;
margin-right:0;
margin-bottom:15px;
margin-left:0;
text-align:left
}
/**
* @tab Page
* @section heading 4
* @tip Set the styling for all fourth-level headings in your emails. These should be the smallest of your headings.
* @style heading 4
*/
h4 {
color:#545454;
display:block;
font-family:Helvetica;
font-size:14px;
line-height:1.571em;
font-style:normal;
font-weight:400;
letter-spacing:normal;
margin-top:0;
margin-right:0;
margin-bottom:15px;
margin-left:0;
text-align:left
}
h5 {
color:#545454;
display:block;
font-family:Helvetica;
font-size:13px;
line-height:1.538em;
font-style:normal;
font-weight:400;
letter-spacing:normal;
margin-top:0;
margin-right:0;
margin-bottom:15px;
margin-left:0;
text-align:left
}
h6 {
color:#545454;
display:block;
font-family:Helvetica;
font-size:12px;
line-height:2em;
font-style:normal;
font-weight:400;
letter-spacing:normal;
margin-top:0;
margin-right:0;
margin-bottom:15px;
margin-left:0;
text-align:left
}
p {
color:#545454;
display:block;
font-family:Helvetica;
font-size:16px;
line-height:1.5em;
font-style:normal;
font-weight:400;
letter-spacing:normal;
margin-top:0;
margin-right:0;
margin-bottom:15px;
margin-left:0;
text-align:left
}
.unSubContent a:visited {
color:#a1a1a1;
text-decoration:underline;
font-weight:400
}
.unSubContent a:focus {
color:#a1a1a1;
text-decoration:underline;
font-weight:400
}
.unSubContent a:hover {
color:#a1a1a1;
text-decoration:underline;
font-weight:400
}
.unSubContent a:link {
color:#a1a1a1;
text-decoration:underline;
font-weight:400
}
.unSubContent a .yshortcuts {
color:#a1a1a1;
text-decoration:underline;
font-weight:400
}
.unSubContent h6 {
color:#a1a1a1;
font-size:12px;
line-height:1.5em;
margin-bottom:0
}
.bodyContent {
color:#505050;
font-family:Helvetica;
font-size:14px;
line-height:150%;
padding-top:3.143em;
padding-right:3.5em;
padding-left:3.5em;
padding-bottom:.714em;
text-align:left
}
.bodyContentImage {
color:#505050;
font-family:Helvetica;
font-size:14px;
line-height:150%;
padding-top:0;
padding-right:3.571em;
padding-left:3.571em;
padding-bottom:1.357em;
text-align:left
}
.bodyContentImage h4 {
color:#4E4E4E;
font-size:13px;
line-height:1.154em;
font-weight:400;
margin-bottom:0
}
.bodyContentImage h5 {
color:#828282;
font-size:12px;
line-height:1.667em;
margin-bottom:0
}
/**
* @tab Body
* @section body link
* @tip Set the styling for your email's main content links. Choose a color that helps them stand out from your text.
*/
a:visited {
color:#3386e4;
text-decoration:none;
}
a:focus {
color:#3386e4;
text-decoration:none;
}
a:hover {
color:#3386e4;
text-decoration:none;
}
a:link {
color:#3386e4;
text-decoration:none;
}
a .yshortcuts {
color:#3386e4;
text-decoration:none;
}
.bodyContent img {
height:auto;
max-width:498px
}
.footerContent {
color:gray;
font-family:Helvetica;
font-size:10px;
line-height:150%;
padding-top:2em;
padding-right:2em;
padding-bottom:2em;
padding-left:2em;
text-align:left
}
/**
* @tab Footer
* @section footer link
* @tip Set the styling for your email's footer links. Choose a color that helps them stand out from your text.
*/
.footerContent a:link,.footerContent a:visited,/* Yahoo! Mail Override */ .footerContent a .yshortcuts,.footerContent a span /* Yahoo! Mail Override */ {
color:#606060;
font-weight:400;
text-decoration:underline
}
/**
* @tab Footer
* @section footer link
* @tip Set the styling for your email's footer links. Choose a color that helps them stand out from your text.
*/
.bodyContentImageFull p {
font-size:0!important;
margin-bottom:0!important
}
.brdBottomPadd {
border-bottom:1px solid #f0f0f0
}
.brdBottomPadd-two {
border-bottom:1px solid #f0f0f0
}
.brdBottomPadd .bodyContent {
padding-bottom:2.286em
}
.brdBottomPadd-two .bodyContent {
padding-bottom:.857em
}
a.blue-btn {
background: #5098ea;
display: inline-block;
color: #FFFFFF;
border-top:10px solid #5098ea;
border-bottom:10px solid #5098ea;
border-left:20px solid #5098ea;
border-right:20px solid #5098ea;
text-decoration: none;
font-size: 14px;
margin-top: 1.0em;
border-radius: 3px 3px 3px 3px;
background-clip: padding-box;
}
.bodyContentTicks {
color:#505050;
font-family:Helvetica;
font-size:14px;
line-height:150%;
padding-top:2.857em;
padding-right:3.5em;
padding-left:3.5em;
padding-bottom:1.786em;
text-align:left
}
.splitTicks {
width:100%
}
.splitTicks--one {
width:19%;
color:#505050;
font-family:Helvetica;
font-size:14px;
padding-bottom:1.143em
}
.splitTicks--two {
width:5%
}
.splitTicks--three {
width:71%;
color:#505050;
font-family:Helvetica;
font-size:14px;
padding-top:.714em
}
.splitTicks--three h3 {
margin-bottom:.278em
}
.splitTicks--four {
width:5%
}
@media only screen and (max-width: 550px),screen and (max-device-width: 550px) {
body[yahoo] .hide {
display:none!important
}
body[yahoo] .buttonwrapper {
background-color:transparent!important
}
body[yahoo] .button {
padding:0!important
}
body[yahoo] .button a {
background-color:#e05443;
padding:15px 15px 13px!important
}
body[yahoo] .unsubscribe {
font-size:14px;
display:block;
margin-top:.714em;
padding:10px 50px;
background:#2f3942;
border-radius:5px;
text-decoration:none!important
}
}
@media only screen and (max-width: 480px),screen and (max-device-width: 480px) {
.bodyContentTicks {
padding:6% 5% 5% 6%!important
}
.bodyContentTicks td {
padding-top:0!important
}
h1 {
font-size:34px!important
}
h2 {
font-size:30px!important
}
h3 {
font-size:24px!important
}
h4 {
font-size:18px!important
}
h5 {
font-size:16px!important
}
h6 {
font-size:14px!important
}
p {
font-size:18px!important
}
.brdBottomPadd .bodyContent {
padding-bottom:2.286em!important
}
.brdBottomPadd-two .bodyContent {
padding-bottom:.857em!important
}
#templateContainerMiddleBtm .bodyContent {
padding:6% 5% 5% 6%!important
}
.bodyContent {
padding:6% 5% 1% 6%!important
}
.bodyContent img {
max-width:100%!important
}
.bodyContentImage {
padding:3% 6% 6%!important
}
.bodyContentImage img {
max-width:100%!important
}
.bodyContentImage h4 {
font-size:16px!important
}
.bodyContentImage h5 {
font-size:15px!important;
margin-top:0
}
}
.ii a[href] {color: inherit !important;}
span > a, span > a[href] {color: inherit !important;}
a > span, .ii a[href] > span {text-decoration: inherit !important;}
</style>
";
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtp.sigpharma.com.br";
$mail->SMTPAuth = true;
$mail->Username = 'mail@sigpharma.com.br';
$mail->Password = 'Sig7978022';
$mail->From = "mail@sigpharma.com.br";
$mail->Sender = "mail@sigpharma.com.br";
$mail->FromName = "Site Compre Certo Franqueado";
$mail->AddAddress($email);
$mail->IsHTML(true);
$mail->Subject = "Contato via Site Compre Certo";
$mail->Body = $body;
$mail->AltBody = $body;
$mail->CharSet = 'UTF-8';
$enviado = $mail->Send();
$mail->ClearAllRecipients();
$mail->ClearAttachments();
if ($enviado) {
$enviou = "enviou";
} else {
$enviou = "falhou";
}
return $enviado;
}