Jump to content

Send php mail with SSL


evop

Recommended Posts

Hi People,

 

I'm using a php to send an mail using a server via ssl. My program:

 

<?php
 
require("class/class.phpmailer.php");
 
$mail = new PHPMailer();
 
$mail->IsSMTP();                       // telling the class to use SMTP
 
$mail->SMTPDebug = 1;                  
// 0 = no output, 1 = errors and messages, 2 = messages only.
$mail->SMTPAuth = true;                
$mail->SMTPSecure = "ssl";              
$mail->Host = "webmail.***.srv.br";        
$mail->Port = 587;                     
 
$mail->Username = "user@***.srv.br";  
$mail->Password = "passw";      
 
$mail->CharSet = 'windows-1250';
$mail->From = '"user@***.srv.br';
$mail->AddBCC ( 'eduardoxxx@xxxx.com.br', 'xx'); 
$mail->Subject = $subject;
$mail->ContentType = 'text/plain'; 
$mail->IsHTML(false);
 
$mail->Body = $body_of_your_email; 
// you may also use $mail->Body = file_get_contents('your_mail_template.html');
 
$mail->AddAddress ('eduardoxxx@xxxx.com.br', 'Recipients Name');     
// you may also use this format $mail->AddAddress ($recipient);
 
if(!$mail->Send()) 
{
        echo "Mailer Error: " . $mail->ErrorInfo;
} else 
{
        echo "Successfully sent!";
}
 
?>
 
but i receive this error:
 
SMTP -> ERROR: AUTH not accepted from server: 503 5.5.1 Error: authentication not enabled SMTP -> ERROR: RCPT not accepted from server: 554 5.7.1 : Client host rejected: Access denied SMTP -> ERROR: RCPT not accepted from server: 554 5.7.1 : Client host rejected: Access denied Mailer Error: Language string failed to load: recipients_failededuardoxxxx@xxxx.com.br, [192.168.9.153]>[192.168.9.153]>eduardoxxxx@xxxx.com.br
 
I tried using command line: openssl s_client -starttls smtp -crlf -connect webmail.***.srv.br:587 and it works!!! Why via php i got the error ?
 
In phpinfo:
OpenSSL support enabled OpenSSL Version OpenSSL 0.9.8h 28 May 2008
 
 
Anyone can help me ?
Thanks.
 
 
Link to comment
Share on other sites

Interesting. What is your real domain name xxxx.com.br or xxxx.srv.br?

Is this your domain (webmail.telecel.srv.br)

[jazz@centos-box ~]$ nmap --script smtp-open-relay.nse -p 25,465,587 webmail.telecel.srv.br

Starting Nmap 5.51 ( http://nmap.org ) at 2014-12-22 07:38 EST
Nmap scan report for webmail.telecel.srv.br (177.185.197.65)
Host is up (0.20s latency).
PORT    STATE    SERVICE
25/tcp  filtered smtp
465/tcp closed   smtps
587/tcp closed   submission

Nmap done: 1 IP address (1 host up) scanned in 2.36 secon

if so the ports 465 and 587 are closed. You need to tell us 

Edited by jazzman1
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.