I am trying to connect to outlook application of office365 using the php PEAR framework. Below are the details of imap
IMAP Host: outlook.office365.com
IMAP Port: 993
Encryption: SSL
IMAP Username: (my Office365 username)
IMAP Password: (my Office365 password)
But i am unable to establish connection to it. Firewall for the port 993 is already opened from the server i am trying. Can someone help me where i am going wrong.
Error:
(
[0] => Array
(
[code] => 1
[params] =>
[package] => Mail_IMAPv2
[level] => error
[time] => 1543397738.02
[context] => Array
(
[file] => /app/lib/PEAR/Mail/IMAPv2.php
[line] => 713
[function] => connect
[class] => Mail_IMAPv2
)
[message] => Unable to build a connection to the specified mail server.
)
)
Our old Imap connection looks like this
imap://{$user}:{$pass}#hostname:port/{$Folder}#notls
We have replaced this format using php inbuilt function
imap_open("{hostname:port/imap/ssl/novalidate-cert/authuser=$user/user=$user}", $user ,$pass);
It is working for us now.
Related
I am using an application in Yii and Postgres database. When I run the application on live server(not local system) I am getting this error
CDbConnection failed to open the DB connection: SQLSTATE[08006] [7] could not connect to server: No buffer space available (0x00002747/10055) Is the server running on host "localhost" and accepting TCP/IP connections on port 5432?"
When I contact with server support team they told to close the db connection after each transaction. I would like to know how to close database connection after each transaction in yii with PostgreSQL?
This is my database connection code in main.php
'db'=>array( 'class'=>'CDbConnection', 'connectionString' => 'pgsql:host=localhost;port=5432;dbname=crescent_6', 'emulatePrepare' => true, 'username' => 'postgres', 'password' => 'root', 'charset' => 'utf8', ), 'cache' => array ( 'class' => 'system.caching.CDbCache', ),
I've got a code I made myself for sending email using Zend Framework2 via gmail SMTP, my code works flawlessly in local host and in some free hosting sites but when running from Hostgator I get this:
File: vendor/zendframework/zendframework/library/Zend/Mail/Protocol/AbstractProtocol.php:225
Message: Connection refused
This is my Code:
use Zend\Mail\Transport\SmtpOptions;
use Zend\Mail\Message;
use Zend\Mail\Transport\Smtp;
$options = new SmtpOptions(array(
'name' => 'Gmail.com',
'host' => 'smtp.gmail.com',
'port'=> 587,
'connection_class' => 'login',
'connection_config' => array(
'username' => 'user#gmail.com',
'password' => 'password',
'ssl'=> 'tls',
),
));
$message = new Message();
$message->addTo('him#gmail.com')
->addFrom('user#gmail.com')
->setEncoding("UTF-8")
->setSubject('test')
->setBody('test');
$transport = new Smtp();
$transport->setOptions($options);
$transport->send($message);
I contacted Hostgator support and they solved my problem, the thing is hostgator servers does not allow smtp relay, so you just have to use an email account that exists within the hostgator server (one created for your domain I suggest). And thats all the problem was about :)
Im trying to connect my website with paypal and i have the index page where i am getting the order price,
the order name and then i refer them to the process.php using get for processing.Howevever,on running the process.php file i am getting this error
Error : Security header is not valid
Array
(
[TIMESTAMP] => 2014%2d10%2d07T17%3a22%3a00Z
[CORRELATIONID] => 37359d983e7a
[ACK] => Failure
[VERSION] => 109%2e0
[BUILD] => 13243702
[L_ERRORCODE0] => 10002
[L_SHORTMESSAGE0] => Security%20error
[L_LONGMESSAGE0] => Security%20header%20is%20not%20valid
[L_SEVERITYCODE0] => Error
)
How can i solve this error.Please Assist
This error comes in when :
You are using the wrong credentials ( make sure you have not copied any white spaces in apiusername. password and the signature .
You are using the wrong endpoints . Meaning you are using test credentials in live mode or vice versa .
I'm using Ruby 1.9.2 and Rails 3.0.4 in development mode and I'm trying to configure it to send emails from the Postfix server installed on the same box (Running Ubuntu 10.04 with the dovecot-postfix package installed) Whenever I attempt to send an email from Rails, it goes through cleanly in Rails but displays an error in the Postfix logs (I've removed domains and IPs from the excerpt below):
Feb 21 04:49:16 alpha postfix/smtpd[9060]: connect from alpha.mydomain.com[xxx.xxx.xxx.xxx]
Feb 21 04:49:16 alpha postfix/smtpd[9060]: lost connection after STARTTLS from alpha.mydomain.com[xxx.xxx.xxx.xxx]
Feb 21 04:49:16 alpha postfix/smtpd[9060]: disconnect from alpha.mydomain.com[xxx.xxx.xxx.xxx]
The strange part is that when I connect to the SMTP server from an email client like Thunderbird, it works with no problems.
I know development mode sometimes doesn't allow for sending emails so I added the following to the environments/development.rb file:
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
#load mail server settings
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "mail.mydomain.com",
:port => 587,
:domain => 'mydomain.com',
:user_name => 'username',
:password => 'password',
:authentication => 'plain',
:tls => true,
:enable_starttls_auto => true }
If you're just sending email from localhost, then you don't need SMTP and all the authentication issues that come with it. You can simply deliver with sendmail directly.
config.action_mailer.delivery_method = :sendmail
Is it possible that your certificate is not valid, and that Thunderbird falls back to plain SMTP when sending emails? Try disabling TLS in your config.
How can I send mail to Gmail using Perl? Here's what I'm trying:
my $mailer = Email::Send->new(
{
mailer => 'SMTP::TLS',
mailer_args => [
Host => 'smtp.gmail.com',
Port => 587,
User => 'xxx',
Password => 'xxx',
]
}
);
use Email::Simple::Creator; # or other Email::
use File::Slurp;
#arrIrc = read_file("$ircFile");
my $email = Email::Simple->create(
header => [
From => 'xxx',
To => "$configList{email}",
Subject => "The summary of logfile $channelName",
],
body => "#arrIrc",
);
Use Net::SMTP::SSL to talk to GMail.
See MIME::Lite inline images on Perlmonks for an example.
If you want to send mail to Gmail, you do the same thing you would do to send mail anywhere. If you want to send mail through Gmail, there is the Email::Send::Gmail module. Merely typing your question in Google led me to Sending Mail Through Gmail with Perl by Mark Sanborn.
You can use MIME::Lite to compose a message, which you then send to your local sendmail process. However, in order to talk to gmail's servers you need to have SSL certificates set up. There's probably more detailed instructions for that on superuser.