Mailgun emails work on local but not server - laravel

I am using the same setup as on the server. I have an EC2 instance running Ubuntu, then I am using Docker to host an Ubuntu image with runs my Laravel project on nginx and php7. My local is setup up the exact same, I use the same Docker image and everything.
When I test my emails on my local they work seamlessly, no errors or problems but as soon as I test it on my EC2 I get the following error in Laravel:
Swift_TransportException: Connection to tcp://smtp.mailgun.org:587 Timed Out in /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:404
I have tried using ports 25, 2525 and 465 butt he exact same result. Here are my env variables:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
MAIL_USERNAME=postmaster#placeholder.com
MAIL_PASSWORD=5uup3rL0nGPa55w0RdY0uPr0bablykn0
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=no-reply#placeholder.com
MAIL_FROM_NAME="placeholder Team"
MAILGUN_DOMAIN=placeholder.com
MAILGUN_SECRET=key-MyK3y1s0ac001y0uw15hy0uhadi7h3h3
The secret and password is fake data
On Mailgun's dashboard I have verified my domain (locally I use localhost.MYDOMAIN.com pointing to 127.0.0.1) and all checks are green except for mxa.mailgun.org and mxb.mailgun.org because we are using gmail for our emails. Not sure if this is the source but I cannot risk disabling the emails just for a test.
If I telnet to Mailgun using telnet smtp.mailgun.org 25 (or any other port) I get a connection, so I do get access.
I also applied to relieve the email sending throttling on my server that Amazon puts onto EC2 servers. Not sure when this will actually be in effect so not sure if it will help or not (It might)
I am not sure why I only get a timeout on my server and it works on my local but any advice would be appreciated!
I did try searching around for answers but did not succeed.
WORKAROUND If anyone is struggling with this same issue, it is not worth the effort, rather just implement the Mailgun API, this way you do not have to put up with these issues, it is what I have now done which, had I known about the issues I would have faced, would have done from the start. So still no solution from my side, just avoided it and also why I am not updating with an answer and instead just updating with an edit. Not sure if this is the correct way.

Related

I can access my heroku free subdomain site via a browser, but I can't ping to it in the terminal

I have this site at heroku that I am trying to ping. It says
Ping request could not find host https://doc-hero.herokuapp.com/. Please check the name and try again.
even though I can still open the site on a browser. I thought it was an issue with heroku so I hosted it again on pythonanywhere but it still won't ping.
I'm sure there is a simple explanation for this but I tried Google and still no luck.
Is there a way I can get it to ping?
You might be wondering why I want it to do that when I can still browse to it. Well, it's because I need it to be visible to Open AI so that it can access some documents over there.
remove https:// prefix. ping is a different protocol and requires DNS only not protocol prefix.
heroku server still will probably not answer ping request as it is not required to.

XAMPP SMTP Blocked by Firewall or wrong settings

(PS using xampp)
Apparently my machine won't send out emails using the Mailing APIs(PHPmailer,Swift) and even PHP's own mail() function. But whenever I run my emailing script on another machine, it works with no errors.
Tried it on other machines such as my univ's pcs, friend's pc and my other laptop.
Fatal error: Uncaught Swift_TransportException: Connection could not be
established with host smtp.gmail.com
Tried everything,but still to no avail on my current machine.
What this tells you is that there is nothing wrong with your script, but that your hosting provider blocks outbound SMTP. This is a very common problem, and it's covered extensively in the PHPMailer troubleshooting guide.
How you actually fix it depends on your ISP - it may be that you just need to ask them to unblock it (Scaleway), or that you need to send via their servers (GoDaddy), or in the worst case, that you need to find a new hosting provider...

Bypass IP restriction SSH

I have a Laravel app with CI/CD setup at BuddyWorks which lets you create deployment pipelines.
I want to use SSH action to run some config scripts (artisan...) after uploading the source code.
Unfortunately, it turned out that SSH connectivity to the hosting server is restricted to my home country, ergo can’t use BuddyWorks to do the job for me. The hosting company refused my request to whitelist BuddyWorks IP’s.
So here am, looking for a solution to bypass restriction.
Currently, I’m investigating SSH reverse for , but not sure I’m on good path.
Any help would be appreciated!
I ended up writing a small http->ssh proxy server with basic authentication which receives commands from pipeline via post requests and connects to the host server via ssh, executes the commands and logs to slack.

Square v2 Server Error

I am testing with the v2 C# payment example.
https://github.com/petespatio/connect-api-examples/tree/master/connect-examples/v2/csharp_payment/PaymentExample
When i run locally everything works properly and i can actually create a payment.
When i try to run on my website (1and1 hosted), i get
error calling charge: unable to connect to the remote server
Does anyone know what has to be done to allow this connection?
Regards
Have you tried pining the server you are connecting to? That's a good place to start. Try:
ping connect.squareup.com
To see if you can connect at all. If you can't ping the server, it might be a firewall issue on your server.
1&1 has information about setting firewall rules on their hardware firewalls for their dedicated linux servers here:
https://help.1and1.com/servers-c37684/dedicated-server-linux-c37687/system-security-c37699
and information on setting firewall rules for their cloud servers here:
https://www.1and1.com/cloud-community/learn/networking/firewall/
Hope this helps!

Set up a simple go server in a webhost

I wanted to set up a simple go server in a webhost. I acquired a domain mydomain.com and hosted it using Bluehost. Now, going through the Go tutorial, I went through this example http://tour.golang.org/#59 and it works fine on my machine. Now, instead, I want to make the HelloWorldServer work when I call mydomain.com:4000 or some other port.
What I did was ssh to my server at bluehost, install go there, then compile the server and run. But then I try to access mydomain.com:4000 and it is not found. I also tried to change "localhost:4000" to just ":4000". any ideas how to make it work ?
Any help or pointers are appreciated. (some more details: it is a shared-hosting account)
This is due to the firewall on your BlueHost server not having ports (including 4000) open on a shared hosting account, Firewall Port Restrictions
If you want to do some simple (and not so simple) web hosting, why don't you look at Google App Engine

Resources