File: /home/kochikidswysewor/www/wp-content/themes/children-charity-child/mails/agent-email.php--
<?php
$args = array(
'post_type' => 'donations',
'p' => $id,
'posts_per_page' => 1
);
$query = new WP_Query( $args );
if( $query->have_posts() ) {
while( $query->have_posts() ) {
$query->the_post();
$amount= get_field('amount',$id);
$case = get_field('case',$id);
$transaction_id = get_field('transaction_id',$id);
$date = get_field('transaction_date',$id);
$name = get_field('name',$id);
$admin_email = get_option( 'admin_email' );
$agency = get_field('agency',$id);
$agencyEmail = $agency->email;
$body = '<style type="text/css">
table {border-collapse:collapse;border:1px solid #444;}
table th, table td{padding:7px 15px;}
</style>
<table width="700" style="border-collapse:collapse;border:1px solid #444;">
<thead>
<tr>
<th colspan="2"><a href="https://kochikids.org" target="_blank" style="color: #dc3779;"><img src="https://kochikids.org/wp-content/themes/children-charity-child/img/mail-template.jpg"></a></th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2" colspan="2" style="padding:7px 15px;border:1px solid #444;">Received a contibution.Details are below:</td>
</tr>
<tr>
<td style="padding:7px 15px;border:1px solid #444;">Name:</td>
<td style="padding:7px 15px;border:1px solid #444;">'.$name.'</td>
</tr>
<tr>
<td style="padding:7px 15px;border:1px solid #444;">Amount:</td>
<td style="padding:7px 15px;border:1px solid #444;">CAD '.$amount.'</td>
</tr>
<tr>
<td style="padding:7px 15px;border:1px solid #444;">Cause:</td>
<td style="padding:7px 15px;border:1px solid #444;">Contribute for '.$case->post_title.'</td>
</tr>
<tr>
<td style="padding:7px 15px;border:1px solid #444;">Transaction ID:</td>
<td style="padding:7px 15px;border:1px solid #444;">'.$transaction_id.'</td>
</tr>
<tr>
<td style="padding:7px 15px;border:1px solid #444;">Transaction Date:</td>
<td style="padding:7px 15px;border:1px solid #444;">'.$date.'</td>
</tr>
</tbody>
<tfoot style="text-align: center;background-color: #dc3779;">
<tr>
<td colspan="2" style="color: #ffffff;padding:7px 15px;">
<a href="https://kochikids.org" target="_blank" style="color: #fff;">Kochikids</a>
</td>
</tr>
</tfoot>
</table>';
$subject = "Kochi Kids -Contribution Received";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html;\n\tcharset=\"iso-8859-1\"\n";
// $headers.= "From:".$this->admin_mailto."\r\n";
$headers .= "From: Kochi Kids <" . $admin_email . "> \r\n";
$to = implode(", ", [$agencyEmail,$admin_email]);
$send = wp_mail($to, $subject, $body, $headers);
return true;
}//end the while loop
}// end of the loop.