Contact form test email with xampp - php

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.

Related

XAMPP mailtodisk feature

This is probably a stupid question but I can't seem to find an answer anywhere. I have made a PHP mail script on localhost and I need to test it, all the emails are being forwarded to the 'xampp/mailoutput' file and I can view them as .txt files. Does this mean that my script is working fine? Or do I need to set up a tool such as 'TestMailServerTool' to test properly.
Yup If you're getting mail output that means php is sending emails successfully.
If you want to get proper email functionality you have to setup an SMTP server in your Windows System. You can also use other SMTP servers like gmail, yahoo or use one which is provided to you by your ISP or your Web Hosting providers.

sending an email using MAMP and php scripts

Hi I am running MAMP on my mac to locally host a website. I want to send an email using php scripts. The stuff i looked online tells me about php scripts for emails but i am unable to send emails. I am guessing this has to do with MAMP settings or maybe i have to make changes to php.ini file but i cant find information regarding that. Can i send emails to my clients using my gmail address running php scripts. I am creating a signup page where once you signup successfully, the site sents you a welcome email. Can some body please guide me how to do this. I have used code from here:
http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm
but this doesnt work.
i have used following settings:
$host = "ssl://smtp.gmail.com";
$port = "465";
MAMP is just Apache, MySQL and PHP and doesn't include a mail server. You could use postfix or, as you said, an external SMTP server.
If using Gmail make sure your account is setup to allow SMTP connections (it's off by default). This can be found somewhere in Settings in the web client. I'd recommend you test it with Mail or another mail client on your local machine to make sure Gmail is working as expected.
Finally (once the above is set up) SwiftMailer or PHPMailer are good mail libraries which can connect to remote SMTP servers. It'll save you a lot of headaches writing your own code, especially when it comes to file attachments and such.

XAMPP mail not working with PHP mail() function

I just installed XAMPP, Apache is running, so is MySQL and Mercury.
In Dreamweaver I created a php file with a mail($to,$subject,$msg,'From:'.$email); function, but when I ran the file from localhost it showed an error. After playing around with xampp control panel, turning mercury on and off, it's not showing any errors, yet is not send the email either... any ideas?
the 'admin' button on the cp for mercury does nothing.
Thanks!
R
You would have to configure the mercury server bundled with xampp to actually deliver/relay the mails.
But I suggest you use something like SwiftMailer instead of php's mail() function.
edit: there is a third option. The mini-smtp-client built into php/win32 can't do authentication. Therefore you can't simply put SMTP=mail.gmail.com; smtp_port=25 in your php.ini. But you can set sendmail_path and point to an application that can relay the message to another smtp server (including authentication), e.g. fake sendmail.
(But I still suggest swiftmailer)
You do not need to use a SMTP server like Mercury to send mails from your PHP.
I personally used two days on this matter, now expert in Mercury, almost, since it never worked with PHP.
Save a lot of time and use SWIFT MAIL, standalone solution, no SMTP server needed - the first example at this link works ! Swift mail is very elegant. Only needed is to download and add the lib folder in your php path. When the mail with the message "Wonderful Subject" ticks in the mailbox at first try, it is indeed a wonderful lib.
http://swiftmailer.org/docs/sending.html
You have to set your SMTP server settings in the php.ini file

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.

Drupal 6 won't send email, for account activation etc

I'm running my own LAMP server locally.
Something i need to setup?
Should it be able to send email using php-mail,
without havin to configure smtp.
Check your phpinfo() information for STMP and the port. Do a test.php file and try to execute this.
mail('email#example.com', 'My Subject', 'Hello World');
http://drupal.org/node/11570
That thread will help you out.
Drupal basically patches into the php mail function, so as with that you either need a mail server installed locally with your lamp setup, or to point apache towards an external or smtp server in your php.ini file.
Ah fixed it, well i didn't-one of our developers did.
Apparently Drupal only uses 'Send Mail' so you have to have it installed, wont use php-mail.
For future reference/research:
try the Drupal module SMTP Authentication Support. I have yet to test it.

Categories