config email yahoo, AOL for codeigniter from the local server - codeigniter

I used the following code for yahoo and it did not work, can you help where I am doing wrong. The same code when I used for the gmail with host as smtp.gmail.com it worked well. I am trying to send an email from the local server using yahoo, AOL, windows hotmail . The following is a file created in application/config folder with the name email.php
$config['protocol'] = "smtp";
$config['smtp_host'] = "ssl://smtp.mail.yahoo.com";
$config['smtp_user'] = "myusername#yahoo.com";
$config['smtp_pass'] = "**************";
$config['smtp_port'] = "465";
$config['charset']="utf-8";
$config['newline']="\r";
$config['crlf'] = "\r";
The working code for gmail
$config['protocol'] = "smtp";
$config['smtp_host'] = "ssl://smtp.gmail.com";
$config['smtp_user'] = "username#gmail.com";
$config['smtp_pass'] = "*****";
$config['smtp_port'] = '465';
$config['charset']='utf-8';
$config['newline']="\r\n";
$config['crlf'] = "\r\n";

Yahoo uses port 995 as the outgoing mail port
http://www.emailaddressmanager.com/tips/mail-settings.html

Related

SMTP Email Send Issue by using PHPMailer

I am New here .I am facing recently Email Send issue from my Windows server. 50% cases mail are unable to send User.
Below Error message are showing
*******Password not accepted from server: 421 4.7.66 TLS 1.0 and 1.1 are not supported. Please upgrade/update your client to support TLS 1.2. Visit https://aka.ms/smtp_auth_tls. [SI2P153CA0009.APCP153.PROD.OUTLOOK.COM]*******
This is my Mail Server Configuration code :
<?php
//require_once('class.phpmailer.php');
//date_default_timezone_set('PRC'); //Set China time zone
date_default_timezone_set('Asia/Dhaka');
$mail = new PHPMailer(); //Instantiate
$mail->SetLanguage("en", 'language.php');
$mail->SMTPDebug = 4;
$mail->SetLanguage("en");
$mail->IsSMTP(); // Enable SMTP
$mail->SMTPAuth = true; //Enable SMTP authentications
$mail->SMTPSecure = 'tls';
$mail->Host = "Smtp.office365.com"; //SMTP server Take 163 mailbox as an example
$mail->Port = 587; //Mail sending port
$mail->Username = "UserName"; //your mailbox
$mail->Password = "Password"; //Your password
?>
I have install Visual studio 2022 for upgrading .NET framework .
Can you please Tell me how can I solved issue ?
The first thing you should always do when presented with an error message is to read it:
TLS 1.0 and 1.1 are not supported. Please upgrade/update your client to support TLS 1.2. Visit https://aka.ms/smtp_auth_tls
This suggests that your server, or at least the PHP version you are running on it, is badly outdated. On top of that, I can see that you are using a very old and unsupported version of PHPMailer, so upgrade.
Finally solved it .I updated my code and Using Latest PHPMailler version .getting 100% mail right now .Below code works for me ..
<?php
require 'includes/PHPMailer.php';
require 'includes/SMTP.php';
require 'includes/Exception.php';
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
$mail = new PHPMailer(); //Instantiate
$mail->isSMTP(); // Enable SMTP
$mail->Host = "Smtp.office365.com"; //SMTP
$mail->SMTPAuth = "true"; //Enable SMTP authentications
$mail->SMTPSecure = "tls";
$mail->Port = "587"; //Mail sending port
$mail->Username = "Username"; //your mailbox
$mail->Password = "Password"; //Your
?>

How to send email in xampp localhost using PHPmailer?

I have attached two different PDF files (mnlocalXampp and rnlocalXampp) that is phpinfo of two different pcs. I have checked both information and seem that both have same information and using same version of PHP but I'm receiving email in mnlocalXampp but not in rnlocalXampp. I also activated openssl in both but i am still not receiving email in rnlocalxampp. Can anyone please look at both the files and let me know what difference in that files and how to configure.
<?php
require 'email_class/class.phpmailer.php';
$mail = new PHPMailer;
$mail->IsSMTP(); //Sets Mailer to send message using SMTP
$mail->Host = 'cp-in-10.webhostbox.net'; //Sets the SMTP hosts of your Email hosting, this for Godaddy
$mail->Port = '465'; //Sets the default SMTP server port
$mail->SMTPAuth = true; //Sets SMTP authentication. Utilizes the Username and Password variables
$mail->Username = 'mn#infotech.com'; //Sets SMTP username
$mail->Password = 'xxxxxxx'; //Sets SMTP password
$mail->SMTPSecure = 'ssl'; //Sets connection prefix. Options are "", "ssl" or "tls"
$mail->From = 'mn#infotech.com'; //Sets the From email address for the message
$mail->FromName = "mn"; //Sets the From name of the message
$mail->AddAddress("m#infotech.com"); //Adds a "To" address
$mail->AddCC("m#infotech.com"); //Adds a "Cc" address
$mail->WordWrap = 50; //Sets word wrapping on the body of the message to a given number of characters
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$mail->IsHTML(true); //Sets message type to HTML
$mail->Subject = 'Project CMS'; //Sets the Subject of the message
$mail->Body = $message; //An HTML or plain text message body
$mail->AddStringAttachment($doc, 'doc.pdf', 'base64', 'application/pdf');
$mail->Send(); ?>
The above sample code is email configuration of mnlocaXampp. For the rnlocalXampp I'm using different Port(Port number: 25), Hosting, SSL enabled.
mnlocalXampp
rnlocalXampp
Thanks in advance
Difficult to know where to start.
You've based your code on an obsolete example and you're using an old version of PHPMailer, so get the latest, and base your code on the examples provided.
You're not defining $doc before you use it.
addStringAttachment is the wrong method to use if you're trying to send a local file; use addAttachment instead.
The definition of $headers is pointless.
There's no point in CC'ing an address you're already sending to.
You have no error checking anywhere.
Resolving some of the above items may help to fix your problem.

Codeigniter send mail working in localhost but not in server

What I am trying
I am building a codeigniter application and need to send mail. My mail configuration works perfectly when I try to send mail from localhost. But its not working when host it on server.
Mail Config
var $useragent = "CodeIgniter";
var $mailpath = "/usr/sbin/sendmail"; // Sendmail path
var $protocol = "smtp"; // mail/sendmail/smtp
var $smtp_host = "send.one.com"; // SMTP Server. Example: mail.earthlink.net
var $smtp_user = "no-reply#domain.com"; // SMTP Username
var $smtp_pass = "pass"; // SMTP Password
var $smtp_port = "25"; // SMTP Port
var $smtp_timeout = 60; // SMTP Timeout in seconds
var $smtp_crypto = ""; // SMTP Encryption. Can be null, tls or ssl.
var $wordwrap = TRUE; // TRUE/FALSE Turns word-wrap on/off
var $wrapchars = "76"; // Number of characters to wrap at.
var $mailtype = "html"; // text/html Defines email formatting
var $charset = "utf-8"; // Default char set: iso-8859-1 or us-ascii
var $multipart = "mixed"; // "mixed" (in the body) or "related" (separate)
var $alt_message = ''; // Alternative message for HTML emails
var $validate = FALSE; // TRUE/FALSE. Enables email validation
var $priority = "1"; // Default priority (1 - 5)
var $newline = "\r\n"; // Default newline. "\r\n" or "\n" (Use "\r\n" to comply with RFC 822)
var $crlf = "\r\n";
I am getting the following error while sending from server
A PHP Error was encountered
Severity: Warning
Message: fsockopen(): unable to connect to send.one.com:25 (Connection timed out)
Filename: libraries/Email.php
Line Number: 1689
The application is hosted at one.com
I had the same problem. After trying several times and failing to find a solution, I changed my protocol to mail. If you are changing the email protocol you may recieve the following error:
A PHP Error was encountered
Severity: Warning
Message: mail(): Policy restriction in effect. The fifth parameter is disabled on this system
Filename: libraries/Email.php
Line Number: 1537
Just change the code at /system/libraries/email.php in function _send_with_mail()
from
if ( ! mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str, "-f ".$this->clean_email($this->_headers['From'])))
to
if ( ! mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str))
because of: “// most documentation of sendmail using the “-f” flag lacks a space after it, however
// we’ve encountered servers that seem to require it to be in place.”
Hope someone can give a solution for sending mail using smtp.
I'm also looking for the solution and most of the time every thing going great on localhost but on server just hell every thing. But after many try one thing I understand as per different servers like - Godaddy, Plesk, Hostinger etc...
It's a game of protocole and port number like -
var $protocol = "smtp";
var $protocol = "tls";
var $protocol = "imps";
var $protocol = "mail";
var $protocol = "sendmail";
Same for port -
var $smtp_port = "25"; //It works most of time on localhost
var $smtp_port = "465"; //For gmail
var $smtp_port = "587"; // Sometime work for gmail and for others
var $smtp_port = "995"; // On few cases
Also there is some cases of smtp user
var $smtp_user = "ssl://smtp.gmail.com";
var $smtp_user = "ssl://smtp.googlemail.com";
var $smtp_user = "tls://smtp.yourmail.com";
var $smtp_user = "imps://smtp.yourmail.com";
var $smtp_user = "smtp.gmail.com";
var $smtp_user = "smtp.googlemail.com";
But most of servers not allow ssl:// or all other prefix they direct want the email address.
Yes it's to confuging but it's ture to configer email on server it's like milestone for first time user on server but after that you know how things going on server and you will easiely find your soluton or not.
But good luck.

Codeigniter login issue.

I have codeigniter powered application and whenever i tried to log in on local server it doesn't let me in without any error message. But when I login in live server it works fine.
#What might be main causes of this issue.
#My config file and database settings are correct
$config['sess_match_useragent'] = FALSE;
$config['phpass_hash_portable'] = TRUE;
//database settings:
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'alumniconnect';
$db['default']['dbdriver'] = 'mysql';
I am using phpass for hashing password and tank_auth for authentication.
Thanks in advance.

Setting Up Emails in Code Igniter 2.02

I’m getting a lot of errors. And I've tried several suggestion across different sites, deleted the parent function, removed the array, updated my php ini file, no luck.
This is the first of 13 errors I’m getting.
A PHP Error was encountered
Severity: Warning
Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.googlemail.com:465 (Unable to find the socket transport “ssl” – did you forget to enable it when you configured PHP?)
Filename: libraries/Email.php
Line Number: 1673
Someone please help.
class Email extends CI_Controller
{
function index()
{
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_port'] = 465;
$config['smtp_user'] = 'myemail#gmail.com';
$config['smtp_pass'] = 'mypassword';
$this->load->library('email');
$this->email->initialize($config);
$this->email->set_newline("\r\n");
$this->email->from('myemail#gmail.com', 'My Name');
$this->email->to('myemail#gmail.com');
$this->email->subject('This is an email test');
$this->email->message('Its working. Great!');
if($this->email->send())
{
echo 'Your email was sent, dude.';
}
else
{
show_error($this->email->print_debugger());
}
}
}
Use a phpinfo(); statement in a .php file to check if the openssl extension actually loaded.
In your php.ini enable php_openssl
extension=php_openssl.so
if you are on Windows, then
extension=php_openssl.dll
Mayowa:
Perhaps I'm a little late and you already has this solved.
After searching a lot in the web I found out that for mail configuration simple quotes and double quotes is not the same.
I use the /application/config/email.php file and after many attempts I found out that this will not work:
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_port'] = 465;
$config['smtp_user'] = 'myemail#gmail.com';
$config['smtp_pass'] = 'mypassword';
But this will:
$config['protocol'] = "smtp";
$config['smtp_host'] = "ssl://smtp.googlemail.com";
$config['smtp_port'] = 465;
$config['smtp_user'] = "myemail#gmail.com";
$config['smtp_pass'] = "mypassword";
Hope it helps.

Resources