| View previous topic :: View next topic |
| Author |
Message |
JT Site Admin
Joined: 28 Jan 2008 Posts: 289
|
Posted: Fri Jan 23, 2009 9:25 pm Post subject: PHP Mail via Google's Gmail |
|
|
We now allow mail through PHP using the fsockopen function. We have allowed access only to the gmail smtp server as to keep abuse from occuring through fsocket and to preven people from spam mailing.
An example of this is this mod to phpbb
http://www.phpbb.com/community/viewtopic.php?f=16&t=345265&p=3048645#p3044743
Last edited by JT on Fri Jan 23, 2009 9:26 pm; edited 1 time in total |
|
| Back to top |
|
 |
JT Site Admin
Joined: 28 Jan 2008 Posts: 289
|
Posted: Fri Jan 23, 2009 9:26 pm Post subject: |
|
|
Here is another example using the PHPMailer class
| Code: | require("mailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->SMTPSecure = "tls";
$mail->From = "*****@gmail.com";
$mail->AddAddress("*****");
$mail->SMTPAuth=true;
$mail->Username='*******';
$mail->Password='*******';
$mail->Port=465;
$mail->Subject = "First PHPMailer Message";
$mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
$mail->WordWrap = 50;
if(!$mail->Send())
{
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
}
else
{
echo 'Message has been sent.';
} |
|
|
| Back to top |
|
 |
Spiers Guest
|
Posted: Mon Feb 16, 2009 5:52 pm Post subject: |
|
|
| Can some one l=please help me to understand this a bit more. I would like to mail also and got the same error. Where do I put this code or is this a download?. I am not running phbb at this time Do you I need to? |
|
| Back to top |
|
 |
JT Site Admin
Joined: 28 Jan 2008 Posts: 289
|
Posted: Wed Feb 18, 2009 2:30 pm Post subject: |
|
|
| Are you writing a custom mailing page in php or using a pre-made script? |
|
| Back to top |
|
 |
Spiers Guest
|
Posted: Wed Feb 18, 2009 11:53 pm Post subject: |
|
|
I would be using a pre made one. I have no clue how to program php into anything but an installation....lol. Al other sites would allow for email so this is new to me but understandable. Is all I do s download the php installer from google onto the site ? And then use the email account I created to send emails back and forth?
Also I am using LGSL for my game servers....since FS sockets not open an dI think they use them then I would not be able to use the program right
Also where do you paste that code at? |
|
| Back to top |
|
 |
JT Site Admin
Joined: 28 Jan 2008 Posts: 289
|
Posted: Thu Feb 19, 2009 2:59 pm Post subject: |
|
|
I have no idea I've never seen that software before. You may want to find the support forum and tell them that you need to use smtp to connect to gmail and see if they support it or has anyone done it before. |
|
| Back to top |
|
 |
Spiers Guest
|
Posted: Sun Feb 22, 2009 6:27 pm Post subject: |
|
|
| LGSL is a utility to monitor game servers and the amount of people in them...lol. but on that code for PhP mailer. Was doing some reading here and there at the PhP mailer site. I am confused on where to put that code? Does it go on all pages or just maybe index? |
|
| Back to top |
|
 |
JT Site Admin
Joined: 28 Jan 2008 Posts: 289
|
Posted: Mon Feb 23, 2009 2:09 pm Post subject: |
|
|
Basically you make a directory called /phpmailer/ and place the php mailer code there.
Then on any page where you want to use that code snippet to send a mail you'll put a "require" command so it includes that code. (note...this is the first line in the code snippet on the first post)
| Code: | | require("mailer/class.phpmailer.php"); |
|
|
| Back to top |
|
 |
|