0

After searching for days on how to do this I came across this question: Send email using the GMail SMTP server from a PHP page

Seems like exactly what I have been trying to achieve but I have had no success, maybe it's because I don't know how to do the HTML to work with this code?

for testing purposes I tried the code on the top voted question on the link I pasted and made a button that when you click it, it would go to the PHP file (No success).

Community
  • 1
  • 1
user519753
  • 1,527
  • 6
  • 18
  • 22
  • It's too vague user519753. What is the errors ? See your HTTP server los. – Gilles Quénot May 17 '12 at 12:11
  • @sputnik user Panique just suggested that I use PHPMailer, all in all It's the same issue I'm getting not matter what technique I'm using; the page will be blank or display the code in firefox and nothing will execute when I go to localhost/send.php – user519753 May 17 '12 at 12:44

3 Answers3

1

You can't do it with PHP only, because mail() doesn't support authentication. You have to use a mailing library.
I recommend SwiftMailer which is easy to use, supports many features (authentication, sending HTML mails, attachments, etc.), and is well documented.

Samy Dindane
  • 17,900
  • 3
  • 40
  • 50
1

You also need to send over tsl/ssl which is why your mail function is not working.

Solution with tsl/ssl already exists here: Using php's swiftmailer with gmail

Community
  • 1
  • 1
Robbie
  • 17,605
  • 4
  • 35
  • 72
0

Check http://neo22s.com/send-email-using-gmail-and-php/ and http://webcodingeasy.com/PHP-API039s/Send-email-from-Gmail-using-PHP

Sliq
  • 15,937
  • 27
  • 110
  • 143
  • When I use the one on neo22s.com this is what happens: I copy paste the text into notepad, type in my gmail information, I save it as send.php and then I go to localhost/send.php and then I get to see the code displayed in Firefox, no execution happens – user519753 May 17 '12 at 12:35