Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Technical Support » Other » PHPBB smtp
PHPBB smtp [message #191719] Fri, 03 March 2006 06:33 Go to next message
sycar is currently offline  sycar
Messages: 144
Registered: February 2006
Location: Reading, UK
Karma: 0
Recruit
Hi guys i host a renegade server and a website along side, my forum is running phpbb2. But my host blocks the php send_mail function so im trying to use the smtp function within phpbb2. The smtp account im trying to use is my gmail one, but i think gmail uses tls for secure connections. any ideas if phpbb2 supports this and if not whether an addon is avaliable?
any ideas or help welcome Smile

thanks buffymaniack
Re: PHPBB smtp [message #191745 is a reply to message #191719] Fri, 03 March 2006 12:38 Go to previous messageGo to next message
dead6re is currently offline  dead6re
Messages: 602
Registered: September 2003
Karma: 0
Colonel
POP3: pop.gmail.com
SMPT: smtp.gmail.com
Username: your-name@gmail.com
Password: ONLY YOU SHOULD KNOW!


Let all your wishes be granted except one, so you will still have something to strieve for.
Re: PHPBB smtp [message #193279 is a reply to message #191719] Sun, 19 March 2006 02:53 Go to previous messageGo to next message
WarZman is currently offline  WarZman
Messages: 26
Registered: September 2005
Location: Netherlands ,The
Karma: 0
Recruit
if you are able to change the php.ini
search for smtp settings change it to you settings and open port 21 in your firewall...
that helped for me
Re: PHPBB smtp [message #207760 is a reply to message #191719] Wed, 12 July 2006 15:11 Go to previous message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
try this...

<?php
function mymail($to,$subject,$message,$headers)
{

  // set as global variable
  global $GLOBAL;
 
  // get From address	
  if ( preg_match("/From:.*?[A-Za-z0-9\._%-]+\@[A-Za-z0-9\._%-]+.*/", $headers, $froms) ) {
     preg_match("/[A-Za-z0-9\._%-]+\@[A-Za-z0-9\._%-]+/", $froms[0], $fromarr);
     $from = $fromarr[0];
  }

  // Open an SMTP connection
  $cp = fsockopen ($GLOBAL["SMTP_SERVER"], $GLOBAL["SMTP_PORT"], &$errno, &$errstr, 1);
  if (!$cp)
   return "Failed to even make a connection";
  $res=fgets($cp,256);
  if(substr($res,0,3) != "220") return "Failed to connect";

  // Say hello...
  fputs($cp, "HELO ".$GLOBAL["SMTP_SERVER"]."\r\n");
  print $GLOBAL["SMTP_SERVER"];
  $res=fgets($cp,256);
  if(substr($res,0,3) != "250") return "Failed to Introduce";
 
  // perform authentication
  fputs($cp, "auth login\r\n");
  $res=fgets($cp,256);
  if(substr($res,0,3) != "334") return "Failed to Initiate Authentication";
 
  fputs($cp, base64_encode($GLOBAL["SMTP_USERNAME"])."\r\n");
  $res=fgets($cp,256);
  if(substr($res,0,3) != "334") return "Failed to Provide Username for Authentication";
 
  fputs($cp, base64_encode($GLOBAL["SMTP_PASSWORD"])."\r\n");
  $res=fgets($cp,256);
  if(substr($res,0,3) != "235") return "Failed to Authenticate";

  // Mail from...
  fputs($cp, "MAIL FROM: <$from>\r\n");
  $res=fgets($cp,256);
  if(substr($res,0,3) != "250") return "MAIL FROM failed";

  // Rcpt to...
  fputs($cp, "RCPT TO: <$to>\r\n");
  $res=fgets($cp,256);
  if(substr($res,0,3) != "250") return "RCPT TO failed";

  // Data...
  fputs($cp, "DATA\r\n");
  $res=fgets($cp,256);
  if(substr($res,0,3) != "354") return "DATA failed";

  // Send To:, From:, Subject:, other headers, blank line, message, and finish
  // with a period on its own line (for end of message)
  fputs($cp, "To: $to\r\nFrom: $from\r\nSubject: $subject\r\n$headers\r\n\r\n$message\r\n.\r\n");
  $res=fgets($cp,256);
  if(substr($res,0,3) != "250") return "Message Body Failed";

  // ...And time to quit...
  fputs($cp,"QUIT\r\n");
  $res=fgets($cp,256);
  if(substr($res,0,3) != "221") return "QUIT failed";

  return true;
}
?> 



it justs opens a connection and sends the data through it.


dan
Previous Topic: Stupid Windows "upgrade."
Next Topic: Hard Drive Tempeture
Goto Forum:
  


Current Time: Sun Apr 28 11:04:25 MST 2024

Total time taken to generate the page: 0.00558 seconds