php - phpMailer does not send email -
i have problem phpmailer. when send form, returns error:
smtp error: failed connect server: connection timed out (110) smtp connect() failed.
here php code
$mail = new phpmailer(); $body = "nome: <strong>".$nome."</strong><br> email: <strong>".$email."</strong><br> txt: <strong>".$txt."</strong><br>"; echo "$body"; $mail->issmtp(); // use smtp $mail->host = "smtp.gmail.com"; // sets smtp server $mail->smtpdebug = 1; // 2 enable smtp debug information $mail->smtpauth = true; // enable smtp authentication $mail->smtpsecure = "ssl"; //secure conection $mail->port = 465; // set smtp port $mail->username = 'email@gmail.com'; // smtp account username $mail->password = 'password'; // smtp account password $mail->priority = 1; // highest priority - email priority (1 = high, 3 = normal, 5 = low) $mail->charset = 'utf-8'; $mail->encoding = '8bit'; $mail->subject = 'test email using gmail'; $mail->contenttype = 'text/html; charset=utf-8\r\n'; $mail->from = 'email@gmail.com'; $mail->fromname = 'gmail test'; $mail->wordwrap = 900; // rfc 2822 compliant max 998 characters per line $mail->addaddress( 'email@gmail.com' ); // to: $mail->ishtml( true ); $mail->body = $txt; $mail->altbody = "nome: <strong>".$nome."</strong><br> email: <strong>".$email."</strong><br> txt: <strong>".$txt."</strong><br>";; $mail->send(); $mail->smtpclose(); if ( $mail->iserror() ) { echo "error<br /><br />".$mail->errorinfo."<br /><br />"; } else { echo "ok<br /><br />"; }
i tried hosting linux register.it, url dmatermoidraulica.simply-webspace.it
Comments
Post a Comment