0
I’m getting some blank emails, it just comes from an email "MISSING_MAILBOX@syntax_error". The others come all straight, with the email of the customer who fills the form
define( 'OWNER_EMAIL', '[email protected]' );
define( 'DONOTREPLY_EMAIL', '[email protected]' );
define( 'OWNER_NAME', 'Menegalli' );
case 'quote-form':
# put the email title here
$title = 'Nova simulação via website';
# email headers
$headers = "MIME-Version: 1.0\n".
"Content-type: text/html; charset=utf-8\n".
"Content-Transfer-Encoding: 8bit\n".
"From: ". $_POST['clientName'] ." <". $_POST['clientEmail'] .">\n".
"Reply-to: ". $_POST['clientName'] ." <". $_POST['clientEmail'] .">\n".
"Date: ". date( "r" ). "\n";
# appointment values
$values = $_POST['values'];
# create rows with values from appointment form
$rows = '';
for( $i = 0; $i < count( $values ); $i++ ) {
$rows .= '<tr>
<td style="width: 200px; font-weight: bold; border: 1px solid #eee; padding: 10px;">'. $values[$i]['name'] .'</td>
<td style="border: 1px solid #eee; padding: 10px;">'. $values[$i]['value'] .'</td>
</tr>';
}
# email content
$content = '<table style="width: 600px; font-size: 11px; border-collapse: collapse;">'. $rows .'</table>';
# sending an email
$result = mail(
OWNER_EMAIL,
"=?UTF-8?B?". base64_encode( $title ) ."?=",
$content,
$headers
);
# if the email wasn't send
if( $result == false ) {
# second version of email
mail(
OWNER_EMAIL,
"=?UTF-8?B?". base64_encode( EMAIL_TITLE ) ."?=",
$content
);
}
break;
Someone’s been through it?
Follows an image of the email source code that comes with no content and email that comes with content. From the left is what comes without the content and the right comes with the content. The problem seems to be that some emails are not picking up the : '. $values[$i]['name'] fields. ' and '. $values[$i]['value'] .'
There are emails that arrive with the content, but there are some that are not enough.
– Pedro Henrique Kuzminskas