Example #1
1
function sl_send_email($to, $subject, $html, $plain = null, $attachment = null)
{
    if (empty($to)) {
        return false;
    }
    $hash = md5(date('r', time()));
    $headers['From'] = 'The LoveMachine <*****@*****.**>';
    $headers['To'] = $to;
    if (!empty($html)) {
        if (empty($plain)) {
            $h2t = new html2text($html, 75);
            $plain = $h2t->convert();
        }
        $headers["Content-Type"] = "multipart/alternative; boundary=\"PHP-alt-{$hash}\"";
        $body = "\n--PHP-alt-{$hash}\nContent-Type: text/plain; charset=\"utf-8\"\nContent-Transfer-Encoding: 7bit\n\n" . $plain . "\n\n--PHP-alt-{$hash}\nContent-Type: text/html; charset=\"utf-8\"\nContent-Transfer-Encoding: 7bit\n\n" . $html . "\n\n--PHP-alt-{$hash}--";
        if ($attachment != null && !empty($attachment['name']) && !empty($attachment['content'])) {
            $headers["Content-Type"] = "multipart/mixed; boundary=\"PHP-mixed-{$hash}\"";
            //encode it with MIME base64,
            //and split it into smaller chunks
            $attachmentContent = chunk_split(base64_encode($attachment['content']));
            $body = "\n--PHP-mixed-{$hash}\nContent-Type: multipart/alternative; boundary=\"PHP-alt-{$hash}\"\n\n" . $body . "\n--PHP-mixed-{$hash}  \nContent-Type: {$attachment['type']}; name=\"{$attachment['name']}\"  \nContent-Transfer-Encoding: base64  \nContent-Disposition: attachment  \n\n{$attachmentContent}\n--PHP-mixed-{$hash}-- \n";
        }
    } else {
        $body = $plain;
    }
    send_authmail(array('sender' => 'authuser', 'server' => 'gmail-ssl'), $to, $subject, $body, $headers);
    return true;
}
Example #2
0
function send_email($to, $subject, $html)
{
    if (empty($to)) {
        return false;
    }
    $headers['To'] = $to;
    $headers['Content-Type'] = "text/html; charset=UTF-8";
    send_authmail(array('sender' => 'authuser', 'server' => 'gmail-ssl'), $to, $subject, $html, $headers);
    return true;
}
Example #3
0
function sl_send_email($to, $subject, $html, $plain = null, $mailq = 'gmail-ssl')
{
    if (empty($to)) {
        return false;
    }
    $hash = md5(date('r', time()));
    if (!empty($html)) {
        if (empty($plain)) {
            $h2t = new html2text($html, 75);
            $plain = $h2t->convert();
        }
        $headers["Content-Type"] = "multipart/alternative; boundary=\"PHP-alt-{$hash}\"";
        $body = "\n--PHP-alt-{$hash}\nContent-Type: text/plain; charset=\"iso-8859-1\"\nContent-Transfer-Encoding: 7bit\n\n" . $plain . "\n\n--PHP-alt-{$hash}\nContent-Type: text/html; charset=\"iso-8859-1\"\nContent-Transfer-Encoding: 7bit\n\n" . $html . "\n\n--PHP-alt-{$hash}--";
    } else {
        $body = $plain;
    }
    send_authmail(array('sender' => 'loveuser', 'server' => $mailq), $to, $subject, $body, $headers);
    return true;
}
Example #4
0
function sl_send_phone_confirm_sms($id, $phone, $country, $provider, $code)
{
    global $provider_list;
    if ($country != '--' && $provider[0] != '+') {
        $smsaddr = str_replace('{n}', $phone, $provider_list[$country][$provider]);
    } else {
        $smsaddr = substr($provider, 1);
    }
    $sms = 'This is your SendLove confirmation code: ' . $code;
    send_authmail(array('sender' => 'smsuser', 'server' => 'gmail-ssl'), $smsaddr, '', $sms, '');
}