I was wondering if there anyway to move this configuration from the INI into the bootstrap.php in a way it would be the default globally. If so, how should I do it? I'm with zend 1.11.
thanks in advance.
;resources.mail.transport.type = smtp
;resources.mail.transport.host = "smtp.gmail.com"
;resources.mail.transport.auth = login
;resources.mail.transport.ssl = ssl
;resources.mail.transport.port = 465
;resources.mail.transport.username = email#example.com
;resources.mail.transport.password = pass
;resources.mail.transport.register = true ; True by default
;resources.mail.defaultFrom.email = email#example.com
;resources.mail.defaultFrom.name = "Foo"
;resources.mail.defaultReplyTo.email = email#example.com
;resources.mail.defaultReplyTo.name = "Foo"
[SOLUTION]
Actually it worked for me adding:
$config = array(
'ssl' => $transport_ssl,
'port' => $transport_port,
'auth' => $transport_auth,
'username' => $transport_username,
'password' => $transport_password,
'register' => $transport_register,
);
$transport = new \Zend_Mail_Transport_Smtp($transport_host, $config);
// var_dump($transport);exit;
\Zend_Mail::setDefaultTransport($transport);
Related
$config = [
'protocol' => 'sendmail',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_user' => '***************',
'smtp_pass' => '********',
'smtp_port' => 465,
'smtp_timeout' => '30',
'mailtype' => 'html',
// 'ssl' => [
// 'verify_peer' => false,
// 'veriry_peer_name' => false,
// 'allow_self_sign' => true
// ],// ini hanya jika jaringa tidak ssl/https, jangan dilakukan di produksi
'starttls' => true,
'charset' => 'utf-8',
'newline' => "\r\n"
];
Hi All, I have
I have tried to send mail from my local host but it return error like bellow,
Message: stream_socket_enable_crypto(): SSL/TLS already set-up for this stream
Thank you for your help,
for sending mail from local i'm using SMTP. Please change your code with following code. It's working for me. Do not edit system file. That will create problem for you in future.
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_user'] = '********'; //your email id
$config['smtp_pass'] = '********'; //email id password
$config['smtp_port'] = 465;
$config['smtp_timeout'] = 5;
$config['wordwrap'] = TRUE;
$config['wrapchars'] = 76;
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['validate'] = FALSE;
$config['priority'] = 3;
$config['crlf'] = "\r\n";
$config['newline'] = "\r\n";
$config['bcc_batch_mode'] = FALSE;
$config['bcc_batch_size'] = 200;
I am sending mail using smtp options. When I sent mail via ssl it is working fine. But when I tried to send mail via tls, it is not working properly.
My application is in CakePHP 1.3.
function testemail() {
$from = 'test#domain.com';
$this->Email->delivery='smtp';
$this->Email->smtpOptions = array(
'port'=>'portnumber',
'auth' => true,
'host' => 'tls://smpt.xxxx.com',
'username'=>'test#domain.com',
'password'=>'xxxxxxxxx',
);
$this->Email->to = 'xxxxxx#gmail.com';
$this->Email->subject = 'Test Email';
$this->Email->from = $from;
$this->Email->replyTo = $from;
$this->Email->return = $from;
$this->Email->additionalParams = '-f'.$from;
$this->Email->sendAs = 'html';
$this->Email->template = 'template';
$this->set('template','Testing TLS mail');
if($this->Email->send()) {
$this->Session->setFlash(__('Mail sent.', true));
} else {
$this->Session->setFlash(__('Error.', true));
}
}
Thanks
try this alternative if your server supports SSL:
'port' => '465',
'host' => 'ssl://smpt.xxxx.com',
This is the script I'm trying to convert in to a standard application.ini zend_db connection:
require_once 'Zend/Db/Adapter/Db2.php';
$config = array( 'dbname' => '*LOCAL',
'username' => '',
'password' => '',
'os'=>'i5',
'driver_options'=> array("i5_commit" =>DB2_I5_TXN_READ_UNCOMMITTED,
"autocommit"=>DB2_AUTOCOMMIT_OFF,
"i5_lib"=>'WEBLIB'));
I don't know how to address the driver_options in the application.ini dot syntax. If it was just a regular connection string, I wouldn't have difficulty.
I would appreciate any help or direction.
i use this application.ini config:
resources.db.adapter = "Db2"
resources.db.params.dbname = "*LOCAL"
resources.db.params.ip = "192.168.1.100"
resources.db.params.os = "i5"
resources.db.params.persistent = true
resources.db.params.driver_options.autocommit = DB2_AUTOCOMMIT_ON
resources.db.params.driver_options.i5_naming = DB2_I5_NAMING_ON
resources.db.params.driver_options.i5_libl = "WEBLIB"
resources.db.isDefaultTableAdapter = true
I am trying to read my Gmail account with Zend_Mail. The request just seems to time out. Is there an issue with my $config?
public function indexAction()
{
$config = array(
'host'=> 'pop.gmail.com',
'user' => 'xxx',
'password' => 'xxx',
'ssl' => 'tls',
'port' => 995);
$mail = new Zend_Mail_Storage_Pop3($config);
$maxMessage = $mail->countMessages();
$this->view->maxMessage = $maxMessage;
$message = $mail->getMessage(1);
$this->view->message = $message;
}
I think you need to use SSL as the ssl type. Also, are you using your full email as the username?
$config = array('host'=> 'pop.gmail.com',
'user' => 'xxx',
'password' => 'xxx',
'ssl' => 'SSL',
'port' => 995);
You don't need to enter ssl and port in case of gmail.
your config should be
$config = array('host'=> 'pop.gmail.com',
'user' => 'xxx',
'password' => 'xxx');
I have this config in application.ini:
resources.session.save_path = APPLICATION_PATH "/../data/session"
resources.session.use_only_cookies = true
resources.session.gc_maxlifetime = 864000
resources.session.remember_me_seconds = 864000
resources.session.saveHandler.class = "Zend_Session_SaveHandler_DbTable"
resources.session.saveHandler.options.name = "jm_sessions"
resources.session.saveHandler.options.primary.session_id = "session_id"
resources.session.saveHandler.options.primary.save_path = "save_path"
resources.session.saveHandler.options.primary.name = "name"
resources.session.saveHandler.options.primaryAssignment.sessionId = "sessionId"
resources.session.saveHandler.options.primaryAssignment.sessionSavePath = "sessionSavePath"
resources.session.saveHandler.options.primaryAssignment.sessionName = "sessionName"
resources.session.saveHandler.options.modifiedColumn = "modified"
resources.session.saveHandler.options.dataColumn = "session_data"
resources.session.saveHandler.options.lifetimeColumn = "lifetime"
Database structure is 100% right and connection to db (working) is set above this. I'm getting error that session_id, save_path etc. are undefined indexes. After that I added this code to bootstrap:
protected function _initCoreSession()
{
$config = array(
'name' => 'jm_sessions',
'primary' => array(
'session_id',
'save_path',
'name'
),
'primaryAssignment' => array(
'sessionId',
'sessionSavePath',
'sessionName'
),
'modifiedColumn' => 'modified',
'dataColumn' => 'session_data',
'lifetimeColumn' => 'lifetime'
);
Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable($config));
Zend_Session::start();
}
After that I'm getting errors that session handler didn't found bd adapter:
Fatal error: Uncaught exception 'Zend_Db_Table_Exception' with message 'No adapter found for
Zend_Session_SaveHandler_DbTable'
Zend documentation is in this case very poor and I simply don't know what could be wrong in my configuration.
i am not very sure where is your problem , but i wanted to share with you my $config array
public function _initsession() {
$config = array(
'name' => 'session', //table name as per Zend_Db_Table
'primary' => array(
'session_id', //the sessionID given by PHP
'save_path', //session.save_path
'name', //session name
),
'primaryAssignment' => array(
//you must tell the save handler which columns you
//are using as the primary key. ORDER IS IMPORTANT
'sessionId', //first column of the primary key is of the sessionID
'sessionSavePath', //second column of the primary key is the save path
'sessionName', //third column of the primary key is the session name
),
'modifiedColumn' => 'modified', //time the session should expire
'dataColumn' => 'session_data', //serialized data
'lifetimeColumn' => 'lifetime', //end of life for a specific record
);
$adapter = new Zend_Session_SaveHandler_DbTable($config);
Zend_Session::setSaveHandler($adapter);
Zend_Session::start();
$session = new Zend_Session_Namespace('App');
Zend_Registry::set("session", $session);
}
Your config is close but not quite right. Here is the code I use in my application.ini file
resources.db.adapter = "Pdo_Mysql"
resources.db.params.host = "localhost"
resources.db.params.username = "grabby_user"
resources.db.params.password = "w8F4cqZpaNz2WeS6"
resources.db.params.dbname = "grabby"
resources.db.isDefaultTableAdapter = true
resources.session.name = "Grabby"
resources.session.save_path = APPLICATION_PATH "/../data/session"
resources.session.use_only_cookies = true
resources.session.remember_me_seconds = 3600
resources.session.saveHandler.class = "Zend_Session_SaveHandler_DbTable"
resources.session.saveHandler.options.name = "session"
resources.session.saveHandler.options.primary[] = "session_id"
resources.session.saveHandler.options.primary[] = "save_path"
resources.session.saveHandler.options.primary[] = "name"
resources.session.saveHandler.options.primaryAssignment[] = "sessionId"
resources.session.saveHandler.options.primaryAssignment[] = "sessionSavePath"
resources.session.saveHandler.options.primaryAssignment[] = "sessionName"
resources.session.saveHandler.options.modifiedColumn = "modified"
resources.session.saveHandler.options.dataColumn = "session_data"
resources.session.saveHandler.options.lifetimeColumn = "lifetime"
Just have to make sure the primary[] and primaryAssignment[] variables are set in the same order.
That is all I needed to get my sessions saved to the database. No need to set anything in the bootstrap file :)