SMTP Email is not working on Joomla - php

I am using joomla 3.2.0 and configured SMTP email account details in the Global configuration to send an email. I am using Joomla com_contact as a contact form. when I fill the data and submit the form, the email is not triggered.
We are facing this issue in live environemnt. But in staging server is working fine. Both server a re Linux server with CENT OS.
In the live server , I have printed error of email send method below. Please suggest what is the issue ?
Error
JException Object
(
[level:protected] => 8
[code:protected] => 500
[message:protected] => SMTP connect failed
[info:protected] =>
[file:protected] => /var/www/html/mywebsite/libraries/legacy/error/error.php
[line:protected] => 178
[function:protected] =>
[class:protected] =>
[type:protected] =>
[args:protected] => Array
(
)
SMTP account configuration for live and staging server are same. But I am facing an issue in live server only. Can anyone suggest what is the issue ?

Related

Connecting to Prosody via JAXL: "This server does not serve username"

I have my own prosody server setup and can connect to it via a windows XMPP client. The server has two accounts on it, and I can connect as both of them and exchange messages between them (I am using the built-in client in Mozilla Thunderbird).
I have a Virtualhost configured on the server ("domain.com").
I am now trying to connect to the server via PHP as one of the accounts and send a message to the other. I have chosen JAXL to do that.
$client = new JAXL(array(
'jid' => 'username',
'host' => 'domain.com',
'pass' => 'mylongcomplicatedpassword',
'auth_type' => 'SCRAM-SHA-1',
'log_level' => JAXLLogger::DEBUG,
'log_path' => './jaxl.log',
'strict' => false,
));
$client->start();
Note the format of 'jid'. This results in an error "This server does not serve username".
If I change the jid to username#domain.com, I get instead "Invalid username."
If I add
$client->require_xep(array('0114'));
before the start(), I get a "This server does not serve... ". in both formats of the JID.
What could be wrong? This is running on PHP 7.1 and the latest versions of JAXL and prosody.

Zend Framework cannot open ssl socket (Abstract.php)

I'm configuring a Magento 1.9.1 to use an external SMTP to send emails, using SMTP PRO (https://www.magentocommerce.com/magento-connect/smtp-pro-email-free-custom-smtp-email.html).
I've setup the configuration (hostname, port, username, password) but when I try to send a test email it fails with a 'Could not open socket' error message. If I dig into the code I see that the error is generated from this piece of code in lib/Zend/Mail/Protocol/Abstract.php:
$this->_socket = #stream_socket_client($remote, $errorNum, $errorStr, self::TIMEOUT_CONNECTION);
if ($this->_socket === false) {
if ($errorNum == 0) {
$errorStr = $remote.' Could not open socket '.phpversion();
}
/**
* #see Zend_Mail_Protocol_Exception
*/
#require_once 'Zend/Mail/Protocol/Exception.php';
throw new Zend_Mail_Protocol_Exception($errorStr);
}
My PHP environment (5.6.30) has openssl support (see image and snippet below)
[root#ns3023903 httpdocs]# php -r 'print_r(stream_get_transports());'
Array
(
[0] => tcp
[1] => udp
[2] => unix
[3] => udg
[4] => ssl
[5] => sslv3
[6] => sslv2
[7] => tls
)
There are no firewall issues as i can both telnet on the port 465 to the target host or send an email using the same SMTP using phpmailer with the same user I use to run the site virtualhost.
I'm on a CentOS 7 64 bit server, with SELinux disabled and, if that matters, I'm using Plesk 12 to configure virtual hosts.
Name resolution is also working ok (I can ping the SMTP name correctly and the IP address is looked up just fine).
I'm obviously missing something here...but what?
It turned out it was something that changed in the PHP version 5.6.30, in terms of default options assumed by stream_socket_client().
First of all before getting rid of the stupid # in front of the stream_socket_client call in the Magento core code I wasn't actually able to understand what was going on. I'm not even close to a PHP developer so I keep forgotting what that stupid # prefix is for (to be honest I don't even know why it exists).
After removing the # I saw this:
Warning: stream_socket_client(): Peer certificate CN=`*.aruba.it' did not match expected CN=`mail.myclientreserveddomain.com'
I looked a bit into the PHP documentation and I came out with a two line diff to the core code (I know this is not right, I'll refactor it now, but I wanted to share the quick workaround first).
Basically I'm creating a context and using another version of the stream_socket_client call
$context = stream_context_create(['ssl' => [
'verify_peer' => false,
'verify_peer_name' => false
]]);
// open connection
$this->_socket = stream_socket_client($remote, $errorNum, $errorStr, 120, STREAM_CLIENT_CONNECT, $context);
Skipping peer name validation is the key. Not sure why/how/when it changed from php pre 5.6.30 to PHP 5.6.30 (have I said I'm not a PHP dev?) but it works. I also tried to run the original code under PHP 5.4.x and it worked without the workaround so it's definitely that.

Intermitant error Named Pipes Provider: Could not open a connection to SQL Server[53]

I've searched through the Internet with respect to this error and I've not found anyone who is having this problem on an intermittent basis. It seems my application will run for an extended period of time with no problem, then all of a sudden it stops working and I get this error. Then after some time(I have no idea how long this is) the application will start working again. But lately to correct the problem I just restart the IIS server. Could there be a problem with the application pool? There are no errors in any of my event logs.
My server configurations are as follows Windows 2008 64-bit running PHP 5.4. I'm connecting to a SQL Server 2005 on Windows 2003.
Here is my error.
Thanks for any help
Connection could not be established.
Array ( [0] => Array ( [0] => 08001 [SQLSTATE] => 08001 [1] => 53 [code] => 53 [2] => [Microsoft][SQL Server Native Client 11.0]Named Pipes Provider: Could not open a connection to SQL Server [53]. [message] => [Microsoft][SQL Server Native Client 11.0]Named Pipes Provider: Could not open a connection to SQL Server [53]. ) [1] => Array ( [0] => HYT00 [SQLSTATE] => HYT00 [1] => 0 [code] => 0 [2] => [Microsoft][SQL Server Native Client 11.0]Login timeout expired [message] => [Microsoft][SQL Server Native Client 11.0]Login timeout expired ) [2] => Array ( [0] => 08001 [SQLSTATE] => 08001 [1] => 53 [code] => 53 [2] => [Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. [message] => [Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. ) )
Is it possible that your Server's IP address lease expires, get's renewed but the DNS record does not get refreshed? It sounds like your server does allow remote connections but for whatever reason, it looks like it is not being found.
I think I solved my problem. I changed my new Web server to only use my internal DNS. I also entered values into my WINS settings for the web server. The error has not occurred since. I hope this helps anybody else who is having the same problem.
I have faced this problem many times and found that this happens because of improper DNS configuration at server level. Hence, namedpipe fails. The solution i discovered is to create odbc (# client) using tcp/ip address instead of domain name of sqlserver.
Named database (default catalog) does not exist on the specified server (host). I get this error on attempt to connect to a linux environment that has no SqlServer at all.

PHP cannot connect to SMTP using TLS

In PHP, I am getting this error while sending email:
"fsockopen() [function.fsockopen]: unable to connect to tls://smtp.gmail.com:465 (Connection timed out)".
Can anyone help me to dynamically load openssl.ddl extention through .htaccess file or any other means other than dl().
I am working with Yii and this is how my main.php is:
'mail' => array(
'class' => 'application.extensions.yii-mail.YiiMail',
'transportType'=>'smtp', /// case sensitive!
'transportOptions'=>array(
//'host'=>$smtp_host,
'host'=>'smtp.gmail.com',
//'username'=>$smtp_username,
'username'=>'mailtest.test10#gmail.com',
//'password'=>$smtp_password,
'password'=>'testtest10',
//'port'=>'543',
'port'=>'465',
'encryption'=>'tls',
//'encryption'=>'ssl',
),
'viewPath' => 'application.views.mail',
'logging' => true,
'dryRun' => false
),
can anyone please let me know where I am wrong....
I solved my problem. Actually this configuration was working in localhost but was giving error in server. Had to change settings to work in server. Changed host value to localhost and changed the username and password to same as in server settings. It is working now.

having issue with fsockopen while sending mail with swiftmailer

I was playing around the new swiftmailer 4.0.4 using my zend studio embbeded apache server where i can send successfully emails through gmail smtp.
Now that it's was fine and that i decided to use it in real project and this time along using xampp 1.6.8.any time i run the same function there is this error
Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?) in C:\xampp\htdocs\project\includes\swift\classes\Swift\Transport\StreamBuffer.php on line 243
i've tried to enable ssl from xampp index file it has accepter the certificate but still my error won't disapear.I'm really concerned about this.Can anyone share his opinion or experience? thanks for reading!
The problem is that you don't have the ssl transport installed for php. Different systems do this in different ways, so I don't know how yours would work.
You can run a quick php app to verify this:
<?php
print_r(stream_get_transports());
Mine returns:
Array
(
[0] => tcp
[1] => udp
[2] => unix
[3] => udg
[4] => ssl
[5] => sslv3
[6] => sslv2
[7] => tls
)
If ssl and tls are not there, then your php installation does not have support for them and you need to find a way to fix that.
i think for some reason it started working.i'm not sure about what happened,i reinstall xampp and didn't see the problem anymore.weird.

Categories