0

Possible Duplicate:
Sending mass email using PHP

Does anyone out there know? I am trying to set up a php file to send data submitted in a form to a mysql database and also one of three email addresses (by means of an if statement). However, I am being told, I need to set up and manage an smtp server and also write code in my php file that connects with smtp server so that it will be possible for me to send email. However, I don't know how to do any of these things and if there is someone out there who does, would you mind helping me out? If so, I would greatly appreciate it.

Community
  • 1
  • 1
user717363
  • 39
  • 1
  • 2

4 Answers4

4

I don't know if anybody is going to give you exact code, but I highly recommend the SwiftMailer library.

Read through the documentation a bit and try it out. It supports sending through your SMTP server instead of using the PHP mail() function.

Charles
  • 50,943
  • 13
  • 104
  • 142
Compeek
  • 909
  • 5
  • 13
1

If you are familiar with Zend framework, there is also a pretty advanced mail feature : Zend_Mail

Marc Bouvier
  • 642
  • 1
  • 11
  • 27
0

Reading the PHP manual's page for mail() would be a good start

Jani Hartikainen
  • 42,745
  • 10
  • 68
  • 86
  • 2
    mail() won't let him use his SMTP server, though. It's still not a bad idea to get familiar with it if he isn't already, but mail() isn't going to do much good if he specifically needs to use his SMTP server. – Compeek Apr 22 '11 at 02:18
  • 1
    The SMTP server mail uses is configurable in PHP settings, so depending on the circumstances it could work. – Jani Hartikainen Apr 22 '11 at 02:37
  • Ah, okay. I didn't think about that. All in all, though, I think most people agree that mail() function is usually not the preferred way to send email if you have another way (such as a third-party library like Swift Mailer). – Compeek Apr 22 '11 at 02:52
0

PHP doesn't actually send the mail. You need a mail server setup on a host machine that is listening for connections. Then in your code you can just use the mail command to actually send the email.

Wes
  • 6,455
  • 3
  • 22
  • 26