
10/04/2013, 09:54
|
| | Fecha de Ingreso: abril-2013
Mensajes: 22
Antigüedad: 11 años, 11 meses Puntos: 0 | |
Respuesta: PHPMailer: Could not instantiate mail function. Solución: Código PHP: if(move_uploaded_file($excel, $destino_excel)){ include_once("class.phpmailer.php"); include_once("class.smtp.php"); $mail=new phpmailer(); $mensaje="Hola mundo";
$mail->IsSMTP(); // telling the class to use SMTP $mail->Host = "smtp.adeccoms-formacion.es"; $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPKeepAlive = true; // SMTP connection will not close after each email sent
$mail->Port = 25; // set the SMTP port for the GMAIL server $mail->Username = "xxxxx"; // SMTP account username $mail->Password = "xxxxxx"; // SMTP account password $mail->SetFrom('[email protected]', 'List manager'); $mail->AddReplyTo('[email protected]', 'List manager'); $mail->AddAddress("[email protected]"); $mail->Subject="asunto";//en espass cambiar $mail->AltBody=$mensaje; $mail->Wordwrap=50;//numero de lineas $mail->MsgHTML($mensaje);//formato html para el mensaje $mail->AddAttachment($rutaDeLoAdjuntado);//accedmos al archivo que se ha subido al servidor y lo adjuntamos if($mail->send()){//si se envio el correo,enviamos el correo $respuesta="el mensaje ha sido enviado satisfactoriamente"; unlink($rutaDeLoAdjuntado);//para borrar el archivo del servidor }else{$respuesta="ERROR:".$mail->ErrorInfo."<br>Ocurrio un error, vuelva a intentarlo porfavor.";} }else{$respuesta="Ocurrio un error al adjuntar archivo0";}
Última edición por jokinini; 10/04/2013 a las 10:12 |