'Test Mail Server Tool' only working in certain cases? - php

I'm currently using Test Mail Server Tool to send emails through the locahost server I have set up (WAMP).
For some reason, the first two e-mails I send work just fine (they show up in the received mail folder), but the other email that is sent from a different PHP file never shows up or mails. The function was working just fine, I didn't change anything. I even did some debugging to see where the code was going wrong - it goes right up to the function and then just doesn't work.
However - when I put the files on another computer, the function seems to work just fine. I made sure I have Skype and any other messaging service that takes up ports closed. I tried restarting my computer, restarting WAMP server and the tool, nothing seems to work.
Any ideas?

Related

duplicate when sending email through swiftmail

I try to send email using swiftmailer the problem is, it send duplicate email (usually more than 3 mails) in same time, it only happen in my server (my local is fine though), first I think it because setting in my server and local is different but I don't find anything fishy, for your information my server running in ubuntu and my local run in xampp windows. please give me suggestion how to solve this

Forcing PHP mail to mock success on dev server

I'm developing a Lumen API (on a VirtualBox) which will occasionally send out emails. However, on my dev server, I don't want to send mails; rather, I'd like the server to fake sending the mail and just return true. In the past, I've done conditionals that check if I'm on the dev server, if so, skip the entire sending mail process, but this feels like the wrong way to do it.
So what I'm trying to get to is: can I somehow get the server to not try sending the email and just move on? Am I thinking about this wrong, and should I try to get mail working on my VB or is a conditional the right way to go after all? I'd love advice on this.
If you are sending emails using illumenate/mail (Lumen 5.3 send email) you can set up the mail driver to log in your .env file for your dev environment. https://laravel.com/docs/5.2/mail.
If you are using your own functions for sending emails you should still get smtp server from .env, so you can set it to a server that will not send out any emails

What is required on web server to send email using PHP/HTML form using Nginx?

I currently have a static website that I am trying to send an email form from. I am using a simple HTML form with fields such as name, email, message, etc. The PHP form is also very straight forward. I don't think there are any problems with the code. In fact, the code is basically exactly like any online tutorial you'd find (http://www.freecontactform.com/email_form.php). I think the problem has to do with the config on the server. I have a Digital Ocean server with Nginx. At first, when I tried to submit the email form I was getting a 405 error. Now that I handle 405 errors in the config file, I am getting the PHP form as a download when I hit the submit button. What do I need to install on the server or include in the config file to make this PHP email form work?
Edit/Update: I have installed Postfix on my web server and am able to successfully send emails from command line using Postfix to different emails outside the server (for instance, I can send from my root user to my personal email addresses on Gmail, etc.). I now have another problem...
This still doesn't help me on the front-end. When I try to click the submit button on the web page form it is still just downloading the PHP file. I think I am missing something in the php.ini folder and maybe some other things as well. Even though I have mail set up on the server, the PHP action button has no idea that it's set up or something along those lines.
You need to install a Mail Transport Agent (MTA) like postfix or exim4. I think you can configure nginx to rely emails to another smtp server.
Another way, would be installing swiftmailer and connect it with an email sending service as sendgrid, mandrill, sparkpost, etc.
Edit:
I personally recomend a sending service as they have white-listed IP for their sending services plus you save memory in your VPS server (as an MTA daemon is not required to run there).
I'm using sparkpost for a few projects and is working perfectly. They have a pretty high limit for a free account.
With any service you choose, ensure to enable DKIM and SPF to avoid been detected as spam.

XAMPP Mail sending on Mac

So something interesting I encountered while working on my site. I use Xampp on a mac OXS Lion to run my website. And I have mail() functions in my code that never worked (sent outgoing mail) before while I was connected to my home internet connection (Verizon Fios).
However, I was recently at a local hospital and logged onto the internet through what seemed to be an unsecure internet connection. While I was working on my site, all of a sudden the mail() functions started working and sending mail... But, when i got back home, it did not work anymore!
How can I figure out what was different, so that I can change some settings maybe in php.ini or maybe my computer configuration, so that I can get it to send mail, like it was doing at the hospital. I am trying to figure it out... any ideas?

How to setup apache and php to make mail() function work on local machine

I am using php's mail() function to send an email from a php scrpit, however, this is not working. I believe the problem is with my php setup and the lack of an smtp server. Does anyone have experience with setting something like this up on a local machine and what can be done to fix this? Thank you
Yes I have on Windows machine. You should install local mail server, for example ArGoSoft Mail Server (www.argosoft.com). It's free, small and simple. Then setup a local domain in settings (for example weblocal.dom), then add a mail user (for example admin). So your test email will be admin#weblocal.dom. Then you just add this mail account to your email client program and send some mail to it from PHP script.

Categories