I'm trying to send e-mail by local.
I'm using Windows 8.1 , Apache, PHP, Sendmail, Stunnel following this site
I aslo followed this page
But I couldn't send e-mail. Following log is shown.
allocated memory : 8.08 MB
command line : c:\sendmail\sendmail.exe -t
executable : sendmail.exe
exec. date/time : 2011-06-18 01:10
compiled with : Delphi 2006/07
madExcept version : 3.0l
callstack crc : $fecf9b34, $97c9b165, $97c9b165
exception number : 1
exception class : EIdSMTPReplyError
exception message : Must issue a STARTTLS command first. iq10sm2936159pbc.14 - gsmtp.
If anyone have another solution, please let me know it.
In my case, following link's setting works for me.
http://sathyasays.com/2014/02/23/getting-php-mail-function-running-on-windows-8-1-with-wamp-server-and-configuring-it-to-use-gmails-smtp-servers/
Related
I understand that Laravel no longer supports the mail() command that Wordpress and probably every other system use to simply send an email.
https://github.com/swiftmailer/swiftmailer/issues/866 shows that they now require smtp. Ok, but even if you sign up for a smtp service, and enter all the details as in:
https://www.bnmetrics.com/blog/sending-email-using-mailgun-laravel5
and php artisan config:cache ... repeatedly... with "smtp" or "mailgun" as the api, it never can even send the reset password built in to the Laravel user system.
Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required"
What's worse is that it never changes from that error message, even if I set
MAIL_HOST=smtp.example.com
it is never a different error message. Which makes me think something is seriously wrong with Laravel Mail (other than the fact it forbids using the standard mail/sendmail that just about any proper configured server can do). Is there a way I can composer install version 5.4.4 which apparently was the last working version according to here, or is there a better way to get Laravel mail working... with or without external service smtp?
If php artisan config:cache doesn't work and you are using e-mails in background using Laravel queues or Horizon, you should run:
php artisan queue:restart
or
php artisan horizon:terminate
to make sure workers will see config changes. Of course you should have Supervisor configured to run those queue workers after being stopped
Route::get('/sometesturl', function() {
var_dump(Config::get('mail'));
echo config('mail.port');
echo config('mail.driver');
echo config('mail.username');exit;
});
shows that there was no username even. Looking in the .env file I found that the added MAIL_ vars were getting overwritten by some defaults below!
I want to connect to a WebSphere MQ Queue using SSL authentification from a PHP application (script).
Queue Manager Version is 7.0 or 7.5
MQ Client Version is 8.0
PHP Version is 7.0 (docker)
Using PHP mqseries pecl extension v0.15 (with custom fixes)
So far I was able to connect without SSL connection.
Here are the steps I have to done so far:
I have installed the WebSphere MQ Client v8 for Linux (CentOS in my case)
I have downloaded the PECL 0.15 version of the mqseries php extension. (There as a small bug in the extension, I had to recompile it to make it work properly. I used to get a segmentation fault on MQGET).
I linked the the mqseries.so to php and enabled the extension.
I succesfully (without SSL)
Connect to the queue manager
Open the queue for reading
Get messages on the queue
Close the connection
When I set the USE_SSL in my script to true, I get the error code 2393 that means "An MQCONN or MQCONNX call was issued with SSL configuration options specified, but an error occurred during the initialization of the SSL environment." This error message is very generic and does not help me pin point where is the problem.
The MQ_KEYSTORE is set as /path/to/my/key and my filename is key.kdb and has at the same level key.sth as suggested by this documentation
The MQ_SSL_CIPHER_SPEC is the same in the script than specified by on the queue manager for the specified MQ_CHANNEL_SSL. Checked multiple times. These are NOT the Cipher Suite used with JMS connections
The security cache has been refreshed on the queue manager.
On the server side, I checked the error logs for the queue manager and didn't seem to see my channel name. I say "seem" because there was a lot of noise and there were a few ??? channel name in the lot. So I feel like it did not reach the queue manager for some reason.
I also used the "amqssslc" command found in the MQ Client installation bin folder to test my ssl config. I get the same error than using the PHP script.
I also used WireShark to sniff packets on the corresponding MQ_PORT. The content of the packages contained certificate information. So there is something that looks like a SSL hand shake going on.
I am now out of ideas as of how to debug the case. Does anyone has an idea of what to check next? Is there connection logs on my MQ Client installation that I should check?
Here is an example of a connection using SSL in PHP
Here is a simplified version of my MQ script (I removed the outputs). Some of the constants are not disclosed for security purposes.
All MQSERIES_* constants are defined in the extension
All MQ_* are hardcoded parameters to test my script but their definition does not appear in the script excerpt.
<?php
// Constants defined here
$options = [
'Version' => MQSERIES_MQCNO_VERSION_4,
'Options' => MQSERIES_MQCNO_STANDARD_BINDING,
'MQCD' => [
'Version' => 7,
'ChannelName' => MQ_CHANNEL,
'ConnectionName' => sprintf('%s(%s)', MQ_HOST, MQ_PORT),
'TransportType' => MQSERIES_MQXPT_TCP,
]
];
if (USE_SSL) {
$options['MQSCO'] = [
'KeyRepository' => MQ_KEYSTORE
];
$options['MQCD']['ChannelName'] = MQ_CHANNEL_SSL;
$options['MQCD']['SSLCipherSpec'] = MQ_SSL_CIPHER_SPEC;
}
mqseries_connx(MQ_QUEUE_MANAGER, $options, $conn, $comp_code, $reason );
$mqods2 = [
'ObjectType' => MQSERIES_MQOT_Q,
'ObjectName' => MQ_QUEUE
];
mqseries_open($conn, $mqods2, MQSERIES_MQOO_INPUT_AS_Q_DEF | MQSERIES_MQOO_FAIL_IF_QUIESCING, $obj, $comp_code, $reason);
$gmd = [];
$gmo = [
'Options' => MQSERIES_MQGMO_FAIL_IF_QUIESCING | MQSERIES_MQGMO_WAIT, 'WaitInterval' => 3000
];
$msg = "";
$data_length = "";
for ($i = 0; $i < 1000; $i++) {
mqseries_get($conn, $obj, $gmd, $gmo, 10000, $msg, $data_length, $comp_code, $reason);
if ($reason === 2033) {
printf("No more messages to process\n");
break;
}
// Business logic
}
mqseries_disc($conn, $comp_code, $reason);
?>
UPDATE
Using the client side logs that I didn't know existed. We finally found out that our server was not using a proper certificate. The server's certificate was actually self-signed, thus not granting us access because our .kdb file didn't have it's public key. We added the server's own public key to the .kdb file making that step work out.
As suggested in the comments from JoshMC, for our next problem, we suspect the label is wrong in the keystore file. We did not specify a specific label from the .kdb file. From the docs "For queue managers and clients respectively, the following sources are searched in sequence for a non-empty value. The first non-empty value determines the certificate label. The certificate label must exist in the key repository. If no matching certificate in the correct case and format is found that matches a label, an error occurs and the SSL or TLS handshake fails."
And it also states that "The certificate label cannot contain spaces.".
I will try again tomorrow with proper label naming and sending a specific label name. I will try to see if the name convention ibmwebspheremq<user_that_runs_the_php_process> actually impacts the validity.
UPDATE 2
It finally worked out. As mentioned by JoshMC, the private key needs to have the specific label ibmwebspheremq. I didn't try the CertificateLabel yet. I might dig into that next week.
At first we were using the GUI (ikeyman) from ibm to generate the .kdb file. But we found out it had quite a few bugs in it. For instance, it imports twice the private key with the same label (auto-generated label from the certificate). Editing the label name was not possible (hence the connection problems). To solve that part we used the command line tool ikeycmd that basically offers the same features on the command line (minus the bugs). To run the command, you need the IBM jre (Not verified, needs to be checked out) and run it as java com.ibm.gsk.ikeyman.ikeycmd. From here, there is a whole world of documentation on IBM web site about how to create a certificate, rename labels, check details, etc. Lots and lots of fun!
With a full IBM MQ client install, client side errors will be logged to the directory: /var/mqm/errors
The errors if any will be logged to the file AMQERR01.LOG (this gets rotated with two other files ending in 02 and 03. If the error is something that MQ is not expecting it may also create a file that ended in .FDC with additional details.
The Queue Manager will log a channel name of ??? if the connection has failed during the channel negotiating prior to the client the sending the channel name. If the IBM MQ the queue manager is using v7.5 or lower the channel name is not exchanged until after the TLS handshake is complete.
With v8 and later clients connecting to v8 and later queue managers, MQ will use TLS SNI to exchange the channel name during TLS negotiation, however I am unsure if MQ has also been enhanced to log this channel name where in prior versions it logged ???. Note that IBM MQ Classes for Java and IBM MQ Classes for JMS client even at v8 and later do not support the SNI feature and do not send the channel name until after the TLS handshake is complete.
Check that your client key.kdb has a private key. There are three ways which MQ uses to identify which private key to use.
With MQ Client v7.5 and earlier the label of the private key must be:
ibmwebspheremq<user_that_runs_the_php_process>
With MQ client v7.5 and earlier an alternative is to set the private key as the default certificate and make sure the following environment variable is set in the environment which executes the program. Note this also works with 8.0.0.7/9.0.0.1 but I prefer the next method over this one.
AMQ_SSL_ALLOW_DEFAULT_CERT=1
With MQ Client v8 and later you can use CertificateLabel=anylabelvalue in the SSL stanza of the mqclient.ini. Example below:
SSL:
CertificateLabel=anylabelvalue
The CertificateLabel setting is documented in the IBM MQ v8 KC page "SSL
stanza of the client configuration file".
A template for mqclient.ini can be copied from /var/mqm/mqclient.ini and placed in the same directory where the application executes. The location can also be specified via a environment variable and MQ will look in a few other locations for the file if it the variable is not set and it does not find it in the same directory where the application executes. The various ways in which MQ will look for this file is documented in the IBM MQ v8 KC page "Location of the client configuration file"
I'm trying to get my first (PHP) application working. It works OK in Google App Engine Launcher, but when I try to deploy it I get the following message:
2014-08-19 15:37:58 Running command: "['C:\\Program Files\\Python\\pythonw.exe', '-u', 'C:\\Program Files\\Google\\google_appengine\\appcfg.py', '--no_cookies', u'--email=by#onetel.com', '--passin', 'update', 'C:\\Documents and Settings\\Barry\\My Documents\\test\\high-winter-668']"
03:38 PM Application: high-winter-668; version: 1
03:38 PM Host: appengine.google.com
03:38 PM
Starting update of app: high-winter-668, version: 1
03:38 PM Getting current resource limits.
Password for b...#...com: Invalid username or password.
2014-08-19 15:38:08,967 ERROR appcfg.py:2411 An error occurred processing file '': HTTP Error 401: Unauthorized. Aborting.
Error 401: --- begin server output ---
Must authenticate first.
--- end server output ---
I can login OK to the application I created at appengine.google.com
and I am using the right/same email address and password.
I can see other topics where server/local time difference is the issue. My local PC time is the same as the time in the above error msg.
What have I got wrong?
Also:
I tried using appcfg.py on the command line and ran into another issue:
It errored saying I didnt have a "high-winter-668.yaml" file. So I changed the name of my "app.yaml" to "high-winter-668.yaml" - it then complained that I didnt specify a 'module" in the yaml file.
Meantime Google App Engine Launcher errored say I didnt have an "app.yaml" file.
Are they written by different companies!!??
Well, in floundering around I've found an answer.
I went here:
https://www.google.com/settings/security/lesssecureapps
and selected "Enable" less secure devices and apps to access your data.
When I tried to Deploy - it worked.
THIS WILL HAPPEN IF YOU HAVE 2-FACTOR authentication activated. The solution in that case is to go to the application-specific passwords page and generate a new password. You can name it "Google app engine" or the like and you'll get a long alpha string to use as the password when deploying.
If you use Google App Engine Launcher and have 2-factor in use you are guaranteed to run into this error on deploy (current version 1.9.17), and it has been that way for at least 1.5 years. It seems like the app engine launcher folks could trap that error and generate a helpful message but instead maybe you'll find it on stackoverflow :)
This happenned to me because I forgot the version line in app.yaml:
version: 1
I am trying to pipe an email address into a php script in ISPConfig administration.
I read that under Email mailbox/Custom rules it could be defined.
I have tried with:
to "|/my/script.php"
or just
"|/my/script.php"
then I found errors in /var/vmail/mailbox/x/.sieve.log
sieve: info: started log at Nov 27 12:58:22. main script: line 5:
error: unknown command 'to' (only reported once at first occurrence).
main script: error: validation failed.
so i guess some valid sieve script should go to Custom rules instead.
Any help would be appreciated.
I think piping the email is feature of email service provide. if he give an option to pipe the email then only u can.
i don't know exactly why this of your problem come. but i faced the same issue before due to service of email.
I use Zend_Smtp to send notifications to users. It worked well. But yerstaday and today I had a lot of errors in error_log like this:
[21-Aug-2012 10:37:44] PHP Warning: stream_set_timeout():
supplied argument is not a valid stream resource in
library/Zend/Mail/Protocol/Abstract.php on line 445
And the email is not sent. What can be the reason of this? Thanks.
According to the PHP doc : http://php.net/manual/en/function.stream-set-timeout.php, I think your application cannot access the email server(the stream).
You can watch about :
Update on the server (change the communication with email)
Firewall or authentification (if you use a remote connection)
But, if you can provide more information about your configuration and implementation...