Drupal 7 - Sending emails from localhost - php

I have Drupal 7.18 on my local machine. I've created a contact form on my site and I've also downloaded the SimpleNews module and created a "sign up for our newsletter" block.
I've tested both of these by filling out the contact form with my email and details and it says the form has been submitted. I've also done the same for the newsletter sign-up and it says "thank you for signing up to our newsletter".
However, these emails aren't getting through to my inbox. I've tried using a couple of different emails but still nothing.
Is it because I'm working locally on my machine? If not, what could be causing this?
Many thanks :)

It's because you are working locally. You need to configure an SMTP client to be able to send emails from a local machine.
Consider using Mercury if you wanna be able to send emails from your local machine. it's free.

Related

How can I send emails with a PHP script from a Bitnami server Debian 10 on Google cloud?

I have a brand new small website hosted on a VM instance on Google cloud that makes use of a Bitmami LAMP stack running on Debian 10. I don't use WordPress, just regular HTML, but I cannot send any emails out.
I also have a similar website on shared hosting with Godaddy where an email form and its PHP script send emails just fine.
The website promotes the services of many small businesses. When visitors get interested in what my customers offer, they fill out an HTML form powered with a PHP script, and an email is sent to the right person regardless of their email service provider.
I've already installed Sendmail on Debian and edited the php.in file so that PHP's mail() function is finally returning TRUE, but emails are still not coming out.
I checked Sendmail's queue, and found that all test emails are being stored. All targeted email addresses used for testing belong to me. One on gmail, one on hotmail and one on a custom domain hosted on Siteground.
I don't need to receive emails. I only need to send emails of interested visitors to my customers.
My needs are simple, so I don't need to use a third-party service to send emails, but I'm stuck, and I don't know what to do next to achieve my goal.
I will appreciate any help. Thank you for reading.

Correct/Recommended Way to Send Email Through GoDaddy Hosting (PHP)

I have been using GoDaddy to host a few websites I build in the past (Coded from scratch with HTML, CSS, PHP, JAVASCRIPT). Most of them are simple websites with the most complex code being the contact forms from which my clients receive emails. I have been using phpMailer to send these emails once a contact form is submitted.
Lately, I've built a new site for one of my clients and came across a problem where I could not get phpMailer to work - turned out I used a wrong Host, where it should have been the URL from cPanel I used my Domain name, simple mistake. However, in search of answers I contacted GoDaddy support and got connected to an "Email Expert(His Words)". He was unable to help me but keep repeating that phpMailer is trash and is really bad with sending emails from a live website. I do have few issues with phpMailer - main one being that emails can take upwards of 10 min to arrive in the mailbox after the form has been submitted, as well as the amount of time it takes to send an email (User click SEND from website and page will load for about 5-10 sec before re-directing to another page with success message).
My question here today is: What is the Best/Recommended and most used way to send email from a live website hosted by GoDaddy.
I came across posts from people who recommend PHP 'mail()' function. - I used it in the past but it has a lot of limitations like the lengths of the email, and for some reason, every time email containing any HTML was sent the email address would change to my cPanel username.
Any Information/Guided is appreciated as I would like to send my emails according to industry-standard rather than using 'Trash' Solutions.
The best way to submit emails through your website is using SMTP services like Sendgrid, Amazon SES, and Mailgun. There is a lot of services out there.
Here you can see a working example on how to send using Sendgrid and PHPMailer.

In Laravel 5.4 MAIL_DRIVER=sendmail is working on one hosting but not on another hosting

I have devoped a laravel 5.4 website on my hosting (purchased from namecheap.com) successfuly. All emails and contact forms were working successfuly on my hosting. and when I delivered website and hosted on client's hosting, every thing is working as it should, but emails (via contact form) is not working. Even it do not show any error and mail is not sent too. when i change MAIL_DRIVER=sendmail to MAIL_DRIVER=log it send mail in log file storage/logs/laravel.log.
any body please help me to solve this problem. I don't that what the problem is being faced.

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.

Switfmailer PHP script not working after switching hosting company

I'm using Swiftmailer for my website's contact form to send the form data via email when it's submitted. I switched to a different hosting company and seemingly everything should be the same, but it no longer works. I'm not getting any error messages. I get status 200 OK when clicking "Submit." I deleted and re-created the email account, but that didn't help. Changed the SMTP authentication information to the new hosting comopany's server, but still no email is sent. Any ideas? Oh, and I switched from Bluehost to A2 hosting. Thanks in advance.
Andrew
1). Check the spam folder
2). Ensure sendmail is installed
3). If reaching to SPAM, allow your server IP in DNS SPF record

Categories