for what reason no use phpmailer? example for an attachment:
function mandaMail ($nombredest, $maildest, $asunto, $cuerpo) {
require_once("mailer/class.phpmailer.php");
$mail = new PHPMailer(true);
$mail->IsSMTP();
try {
$mail->Host = "xxxx"; $mail->Port = 25; // smtp server
$mail->SMTPAuth = true;
$mail->Username = "xxxx"; // smtp username
$mail->Password = "xxxx"; // smtp pass
$mail->AddReplyTo("xxxx", "xxxx"); // email & name
$mail->SetFrom("xxxx", "xxxx"); // similar to up value
$mail->AddAddress($maildest, $nombredest);
$mail->Subject = $asunto;
$mail->MsgHTML(file_get_contents($cuerpo));
$mail->AddAttachment("xxxx", "xxxx"); // attachments directory, attachment name (ie: dir/blah.jpg, blah.jpg)
$mail->Send();
} catch (phpmailerException $e) { echo $e->errorMessage();
} catch (Exception $e) { echo $e->getMessage(); }
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…