-
-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable setting of stream context options #8
Conversation
Set context, not timeout
@@ -41,6 +41,9 @@ class SmtpMailer extends Nette\Object implements IMailer | |||
/** @var bool */ | |||
private $persistent; | |||
|
|||
/** @var array */ | |||
private $context; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be probably named $streamContext
or at least mentioned in doc
/** @var array stream context */
private $context;
Also fix the false indentation, and on unset stream context in the input options default to NULL.
Please add a test. |
@@ -122,6 +126,11 @@ protected function connect() | |||
if (!$this->connection) { | |||
throw new SmtpException($error, $errno); | |||
} | |||
|
|||
if ($this->streamContext) { | |||
stream_context_set_option($this->connection, $this->context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
context vs. streamContext.
Oh god. This is embarrasing. I'm currently in a lot of work and really little time, I'll redo the whole PR tomorrow or next week. |
0985d62
to
1d54312
Compare
c4f379b
to
73946cc
Compare
Closed by #30 |
Some situations, namely mine, require to set some stream context options. This PR enables just that. User has to set an option array at initialization with an array that fits requirements of http://php.net/manual/en/function.stream-context-set-option.php