Apple Push Notification not working on shared server - iphone

I want to send APN (Apple Push Notification) from PHP script. My PHP script is working fine and I receive notification in the iphone device as well when sending from localhost but when I upload the same script with same .pem file to the shared server it returns error...
Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.push.apple.com:2195 (Connection refused) in /mypath/SendPushNotification.php on line 28 Failed to connect: 111 Connection refused
From some source I get to know that to send APN port 2195 must be open which is not possible in the shared server plan. So I tried using dedicated server and it's working perfectly and I receive the notification on the device. I tried hard to find the solution for shared server but didn't find any solution.
My question: is it possible send APN without opening port 2195 from shared server? if Yes give some guidance.

No, Its not possible to send APN message without using 2195 port.
If you want to send push notification message from shared server, try using some third party tools like http://urbanairship.com/.

Some time ago I got the same error, and then I found that it ocurres because of the server, the proxy is blocking that port, because most of servers doesn't use that port as a common one(80 or 21).
In this case you could try asking for support on your server reseller , they can open that port (2195) for you, If your take this solution I would recommend also asking to open the port 2196 that port is used for feedback.
Another solution is to use a free push notification provider, like Parse which is really easy to use and implement on your app, also you can use UrbanAirship, but I preffer Parse ;)
Hope it helps

This is irritating and definitely port 2195 issue. Chat with your hosting provider and ask them to open the port. I also had same issue. My Local code was running peacefully in every condition like sandbox and production but it was failing on the server.
Dont get confused about .pem file path and that would be simple corresponding to your code. For me i put my certificates (.pem) in a directory named certs and gave path like this:
$apnsCert = 'certs/cert_prod.pem';
The code was not working on my apps production server. I wasted one and a half day on this but that ran great on first run when i put that on application's staging server. Reason!!!! Definitely port 2195 issue.
All the beat.

Related

Remote.it and openVPN together

So this is a classic question that I’ve seen many times before...
I’m trying to connect to my home network when not at home using a raspberry pi.
I’m well aware that the way to go with this is to use a vpn server such as OpenVPN.
However, in order to connect to the vpn I would need to forward a port on my router... which I can’t do.
I’ve found remote.it which allows remote connection to a computer (pi) without port forwarding.
What I would like to know is how would I set about using the 2 together, I.e. connecting to remote.it which in turn connects me to my vpn server?
I'm sorry to be finding this question just now, but in case it's still useful to you or to anyone else, here's what you need to do:
Install remote.it
Set-up a remote.it connection to use the protocol (TCP/UDP) and port required by the VPN application
Make a remote.it connection/adding the service to your network (remoteit - Desktop application UI terminology)
Use this connection info (URL/port or localhost:port) with the VPN client
Send an e-mail to support#remote.it if you need help
I would recommend ZeroTier(https://www.zerotier.com/). It haves its own linux client , and you can connect to as many networks as you would like.
You can also configure IP address from the website.
There is also an Android an IOS app that is really simple to connect.

sending mail to mailtrap.io

I am using Laravel 5.1
I made a contact page in my application. So users can send an email. Here I have used mailtrap.io
It works when I have created. I mean there was no problem to send mail to mailtrap.io
But today, when I was checking this again, It shows me this error.
Swift_TransportException in StreamBuffer.php line 268:
Connection could not be established with host mailtrap.io [A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. #10060]
I have checked my .env file with mailtrap.io setting. everything is ok. Here is my .env file setting
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=25
MAIL_USERNAME=[username]
MAIL_PASSWORD=[password]
MAIL_ENCRYPTION=tls
Anyone please help me?
Probably you have issues with port 25 being blocked by your provider or host.
You can verify this using telnet:
telnet smtp.mailtrap.io 25
If you get no response or a timeout, you can not use port 25.
Mailtrap allows you to use 2 other ports, 2525 and 465.
You can verify with telnet if those ports are working.
telnet smtp.mailtrap.io 2525
If that connects properly, modify your .env file to use 2525.
If you are using php artisan serve instead of homestead or something else, be sure to restart after making changes to your .env.
try
MAIL_PORT=465
instead of
MAIL_PORT=2525
like this
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=465
MAIL_USERNAME=your_username
MAIL_PASSWORD=your_password
MAIL_ENCRYPTION=tls
Update your composer by giving
composer update
and run your application.

Java Web application not sending Email on Ubuntu server

My play framework web application sends automatically emails to user using Apache commons email library, everything works fine on my machine, but when I deploy it on an Ubuntu server it is unable to send email.
It throws exceptions like org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.googlemail.com:465 (I also tried different configuration with smtp.google.mail port 465,25 and 587 with or without ssl and tls)
and connection timed out.
I starting to believe that is a problem of some configuration of my ubuntu server.
Any suggestion?
If i type ufw status command I receive status disabled.
Thanks
I am going to close this question, because I found the solution. Basically my Server provider (Scaleway) has a security configuration where SMTP is blocked. I asked them to unlock It.

How we can check that our IP is blocked by apple from using APNS service

My apns was fine till yesterday. But today onwards am getting this error.
.Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.push.apple.com:2195 (Connection timed out)
I didn't change anything. I am using an adhoc distribution profile.I used apns service too many times for testing. So i am confused about whether apple blocked my ip.How we can check that our IP is blocked by apple from using APNS service ?
Which version you are using? If it is 5.2, please test with 5.3
If you are using 5.3, then please make sure whether SSL is on or off (enabled or not).
While I can't help you check your IP addresses (well, aside from trying a new IP, or proxy), here are some things you can try to restore your APNS ability.
I would check your push certificate. It may have expired.
Also, look into Urban Airship. UA is a great service that helps you with using APNS. I have seen them mention Sandbox control specifically to avoid your problem of pushing the limit. (pun intended.)
EDIT:
Based on the last part of your error, (Connection Timeout), it does not look like an IP block. It would say (Connection refused).

Skpsmtpmessage: which server should i use for gmail

I got this project "skpsmtpmessage" and I tried to send mail first. So I changed all the mail id to gmail id. But replay host is problem. I tried smtp.gmail.com, smtp.google.com, smtp.googletalk.com. But when I run my program, I get error that "Unable to connect server"
Which relay host should I use for gmail.
The correct SMTP server for Gmail is smtp.gmail.com, but I don't know how to help you further, the question is pretty vague.
You can also take a look at the configuration instructions for using Gmail on the iPhone to see if you're making a mistake with another parameter.