Example #1
0
    }
}
$attres = mysql_query("select * from " . $table_prefix . "ea_attachments where cid={$row['0']}");
while ($at = mysql_fetch_row($attres)) {
    //$filename = "attachments/$at[1]/$at[2]";
    $pathToServerFile = "attachments/{$at['1']}/{$at['2']}";
    //** attach this very PHP script.
    $serverFileMimeType = 'application/octet-stream';
    //** this PHP file is plain text.
    //** attach the given file to be sent with this message. ANy number of
    //** attachments can be associated with an email message.
    //** NOTE: If the file path does not exist or cannot be read by PHP the file
    //** will not be sent with the email message.
    $message->Attach($pathToServerFile, $serverFileMimeType);
    if ($smtpmailer == 1 && $flag_var == 1) {
        $mail->Addattachment($pathToServerFile);
    }
}
//echo "hai";
if ($script_mode != "demo") {
    //echo "live";
    $send_res = 0;
    if ($smtpmailer == 1 && $flag_var == 1) {
        $send_res = $mail->Send();
    } else {
        $send_res = $message->Send();
    }
    if ($send_res) {
        echo "<br>Your mail was sent successfully. <a href=\"javascript:history.back(-1);\">Go Back</a><br>";
    } else {
        echo "<br>Sending failed. <a href=\"javascript:history.back(-1);\">Go Back</a><br>";