I have a small web form that on submission triggers a mail script that sends an email to the address given to verify their email address.
I want to test this on my local server using MAMP Pro. I am totally confused from the info I have sourced that holds different advice and requirements.
I use Dreamweaver (DW) with WebAssist (WA) extensions to build my PHP scripts and when I contacted WA support to ask how to enter the correct settings with their DW plugin to work with MAMP pro they told me..
To have your localhost send email you need to install a local SMTP server configured for email relay.
If you want to use a remote smtp server you would likely have to use the PEAR mail option for authentication.
This has thrown me as I can't see anywhere in any MAMP Pro documentation about having to install SMTP servers and I know nothing about PEARL.
The following Blog makes it sound simple..
http://blog-en.mamp.info/2009/09/how-to-sending-emails-with-mamp-pro.html
But it obviously isn't as I have tried these Postfix settings with know joy.
I have also seen this post..
Test emails locally with mamp
..that gives a method using gmail but I just can't make sense of it as It appears that the MAMP interface may have changed since this was written.
Plus I am not familiar with using Terminal.
If anyone can shed some light on this to point me in the right direction I would be most greatfull
You can use Mailhog to achieve this. I wrote a tutorial on Medium.
Install mailhog using Homebrew (if you don't have Homebrew installed, check out the instructions here: https://brew.sh/):
brew install mailhog
Open MAMP Pro and go to the “Postfix” tab. Make sure the checkbox next to “Include Postfix service in GroupStart” is checked.
Use these setting for Postfix:
Fill in your domain name in the field “Set domain of outgoing e-mails to:”
Check “Use a Smart host for routing”
“Server name:” is 127.0.0.1:1025 (this is the SMTP port Mailhog uses)
Set “Authentication” to “none”
Go to http://127.0.0.1:8025/ in your browser to see the mails sent by PHP.
Related
I am trying to work with a shared host in which the mail() function was disabled (I can see that on disabled functions on phpinfo()) by someone that I don't know.
All I have access is the root folder for the site files in the ftp, so I can't edited the php.ini in /etc/ neither restart Apache (I know is a linux based OS).
Is there any way I can enable it by a secondary php.ini or ini_set()?
EDIT: I am aware of PHPMailer. I was trying to use it but it was being block as well. That's why I started trying to use mail(). Just to see if it would work
You need to get a new host or upgrade to some different plan.
However you can go ahead with mailgun(https://www.mailgun.com/) which is very cheap and no cost to set up.
You just need to link your credit card for a safety but they never charge you unless you pass 10,000 emails per month(https://www.mailgun.com/pricing).
There are other solutions as well like mandrill or sendgrid. However, Mailgun is almost free unless you are using more transactions emails.
You can find the official mailgun php package in here : https://github.com/mailgun/mailgun-php
You need to check if curl is installed in your server though.
Secondly, trying to send emails directly is not a good practice. Most of the times they will end up getting in spam folder. Use SMTP and use PHPMailer Extention.
Steps to do so :
1. So to cpanel and go to emails
2. Create a new email account and add a password
3. Click on configure mail client related to the new email address you have created
4. You will get 2 tabs, SSL configurations and NON SSL configurations
5. You can choose TLS, copy the outgoing host, email and password.
6. Now install phpmailer and enter the above credentials and try sending email.
7. Also as a safety, go to authentication in your cpanel and check if any issues are mentioned for emails just for safety.
I have a contact page that I made following this tutorial, when I click send I get a message telling me that the message has been sent, but I ain't receiving any email, I'm trying to test it locally with xampp v3.1.0, I read that I have to change the smtp in php.ini, but it didn't work either.
I want to test it with my localhost, what do I have to do?
As can be seen in the link "Mail" in XAMPP homepage (i.e. "localhost"), with the default configurations of the XAMPP, mails sent by the php mail function can be found in ".../xampp/mailoutput" folder (Windows). This is useful for test purposes.
Maybe your change to the "php.ini"s SMTP directive can be a problem to this approach.
You often don't have mail capability from your local server unless you specifically set it up that way. If you want to be able to send mail locally, refer to this link. Of course, there are other ways, such as installing hMailServer or some other smtp server, but you should have sendmail as part of your Xampp installation.
I'm looking for an SMTP server that I can setup on a windows machine:
It needs to be lightweight, not loads of security settings
I only need to send email not receive it
Its needs to be able to send email from anonymous users
The reason is that I've installed Apache and PHP on a windows machine and want an SMTP server to route mails through, I plan on using this windows sendmail.exe which I have used before and works great.
Last time I did this I used sendmail.exe and Stunnel and used a gmail address, but I can't do that this time, needs to be sent from localhost.
You could use the SMTP server integrated in IIS, you could also go for smaller mail servers like http://www.xmailserver.org/ or http://www.mailenable.com/
Too bad, stunnel/gmail is great and I've used it a ton for test environments.
Two great alternatives are to install exim via Cygwin, or to use IIS as an SMTP server.
I have personally used the first with success. I have never tried IIS although I know this is a viable solution for some.
I'd like to test password recovery and similar email related features for a website.
I'm using PHP (cakePHP framework) and the syntax seems easy enough but I'm unsure of the email server setup.
I've looked around for a good tutorial but they aren't specific enough.
What is a quick and easy mail server to use locally? also... some initial steps to start up would be appreciated.
Test Mail Server Tool
xampp comes with a smtp server for sending mails from localhost, check out http://www.apachefriends.org
I've had good success with SMTP4DEV on a Windows box. It is open source.
You can see recent messages fairly easily with this tool. All it requires is that in your application you use localhost as the SMTP server.
From what I remember PHP has a config file has a entry for the SMTP server. You can get a local SMTP server and point ini for PHP to localhost.
On Windows Microsft Internet Information Server would have SMTP, I think even client will have an SMTP relay (may not be a full server however). or I am sure you can find numeros free SMTP server.
You could look at Post Case although I don't believe it is now (currently) free - it used to be, or you could look at Hamster 2.1 which is free, and then there is hMailServer 5.x.
I was wondering how to auto generate a user email accounts in Drupal? I do not have a host currently but am trying to get my head around how this would be done.
The Postfix mail server allows you to use a set of MySQL tables to set up mail accounts. With a little bit of custom coding against hook_user(), you could have new users get added to your Postfix tables and thus have e-mail addresses all nicely setup ready to go.
There is a Drupal module for that: the Mailfix for Postfix module. Here is an excerpt from its project page:
... integrates Drupal with Postfix, providing email accounts to regular Drupal accounts.
For this module to work you must have previously installed and configured Postfix 2.1 or greater. A step-by-step installation guide for an Ubuntu 8.04 server is available at HowToForge.
Once your Postfix server is appropriately configured you may install this Drupal module.
The other way you could do it is by using exec on your local server to run a script which adds a mail account. It really depends on your server environment.
Drupal is not an email server - hence you must connect Drupal to an email server in some way, most likely through the use of a custom module.