I am trying to modify email notification code so that when a condition is met, a variable will change.
Basically, if the last $key_row->keyVal in the loop has any upper or lower letters in the 13 character string, then it will make the server addresss variable equal to server2.domain.com. Else server address variable equals server1.domain.com . Server address variable does not exist yet and won't be used outside this area.
Thank you for any help.
if (isset($_POST['emailcustomer']) && $_POST['emailcustomer'] == "1")
{
// Send email
$to = email_sanitize($row->ordEmail);
$subject = 'Keys';
$message = '
<b>Keys Order</b><br />
Thanks for your recent order. Here are the keys that you ordered: '.$row->ordID.':<br /><br />
';
while ($key_row = $key_query->fetch_object())
{
$message .= 'Username: ' . $key_row->keyVal . ' / Password: ' . $key_row->keyVal . ' / Expiration: ' . strtoupper(date('d-M-Y', strtotime($key_row->keyEnd))) . '<br />';
}
$message .= '<br />
<br />
Server Address: server.domain.com (<---Variable Here)<br />
';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: ' . $from_name . ' <' . $from_email . '>' . "\r\n";
mail($to, $subject, $message, $headers);
print 'Email sent.';
}
Aucun commentaire:
Enregistrer un commentaire