I work with PHP and I have mamp on my machine. I would like to send emails within my PHP code:
<?php
$to = "recipient@example.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>
How can I configure a mail server for free on my mac machine ?
Are there any smtp server i can install on linux mac ?
Sending Mail from PHP Using SMTP Authentication - Example:
Sending Mail from PHP Using SMTP Authentication and SSL Encryption - Example:
Related topics:
Option 1:
CommandLineFu had this one liner to run an SMTP server on port 25:
This will run a fake smtp server on your local machine. It won't send anything, but will dump it to the console.
Option 2:
Incase, you are not comfortable with command line then FakeSMTP is a Free Fake SMTP Server with GUI for testing emails in applications easily. It is written in Java. It is very nice and easy to use.
[http://nilhcem.com/FakeSMTP/][1]
Kindly upvote the answer if it help :)
The following did the job. See source here.
sudo emacs /System/Library/LaunchDaemons/org.postfix.master.plist
.<key>RunAtLoad</key> <true/> <key>KeepAlive</key> <true/>
before the closing</dict>
tag.sudo postfix start
.Check that SMPT is running:
telnet localhost 25
Try this - http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm
and if you want an SMTP server to send mail from on OSX, this may help (havent actually tried it, but seems like it could do the job) - http://email.about.com/cs/sendmail/gr/sendmail_enable.htm
Hope that helps!