Jump to content

RieqyNS13

Members
  • Posts

    7
  • Joined

  • Last visited

About RieqyNS13

  • Birthday 07/18/1997

Profile Information

  • Gender
    Male
  • Location
    trash
  • Interests
    handsome man

RieqyNS13's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I send EHLO command to gmail stmp. if response was success, it will send code 250. I try to catch the response code of gmail smtp. when my code like this $fp = fsockopen("ssl://smtp.gmail.com", 465, $errNo, $errStr, 15); if(empty($fp)){ echo $errNo.":".$errStr; }else{ fputs($fp, "EHLO"."\r\n"); $rp = get_lines($fp); $code = substr($rp,0,3); echo $code; fclose($fp); } function get_lines($fp){ while($str = fgets($fp)){ return $str; } } why it always produce code 220 ? but when I append the php code with echo fgets($fp); like this $fp = fsockopen("ssl://smtp.gmail.com", 465, $errNo, $errStr, 15); if(empty($fp)){ echo $errNo.":".$errStr; }else{ echo fgets($fp); //additional code fputs($fp, "EHLO"."\r\n"); $rp = get_lines($fp); $code = substr($rp,0,3); echo $code; fclose($fp); } function get_lines($fp){ while($str = fgets($fp)){ return $str; } } the output like this: 220 mx.google.com ESMTP vu10sm20075869pbc.27 - gsmtp <<don't need this 250 code 250 has caught. but how to produce code 250 without additional command like echo fgets($fp); ?
  2. I want to learn about manage the smtp with php. I have read some of PHPMail class, but there too many lines code. so, I decided to ask to this forum to learn step by step. do you know slices code of $mail->getFile('contents.html') in phpMailer class ? I have not founded it in class.smtp.php and class.phpmailer.php
  3. are this smtp commands is valid ? DATA From: "Edited Out" <editedout@yahoo.com> To: "Edited Out" <editedout@yahoo.com> Subject: Testing 4 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="boundary-type-1234567892-alt" --boundary-type-1234567890 --boundary-type-1234567892-alt Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
  4. how do send html format with gmail smtp ? I just know some commands of smtp gmail to manage email they are MAIL FROM and RCPT TO. does it can be combined with mail($to, $sbj, $msg, $hdrs) ?
  5. thanks for your reply. but last minute I've add delay after every fputs() execution, and it works so, the code like this: $fp = fsockopen("ssl://smtp.gmail.com", 465, $errNo, $errStr, 15); if(!$fp){ echo "not connected"; }else{ fputs($fp, "EHLO"."\r\n"); Sleep(2); fputs($fp, "AUTH LOGIN"."\r\n"); Sleep(2); fputs($fp, base64_encode("target@gmail.com")."\r\n"); Sleep(2); etc.....
  6. I've tried your solution, but the email still not sent here : <?php $fp = fsockopen("ssl://smtp.gmail.com", 465, $errNo, $errStr, 15); if(!$fp){ echo "not connected"; }else{ $str = fputs($fp, "EHLO"."\r\n")."\n"; $str .= fputs($fp, "STARTTLS"."\r\n")."\n"; $str .= fputs($fp, "AUTH LOGIN"."\r\n"); $str .= fputs($fp, base64_encode("author@gmail.com")."\r\n")."\n"; $str .= fputs($fp, base64_encode("password")."\r\n")."\n"; $str .= fputs($fp, "MAIL FROM:<author@gmail.com>"."\r\n")."\n"; $str .= fputs($fp, "RCPT TO:<target@gmail.com>"."\r\n")."\n"; $str .= fputs($fp, "DATA"."\r\n")."\n"; $str .= fputs($fp, "Subject: This is subject"."\r\n")."\n"; $str .= fputs($fp, "This is body message"."\r\n")."\n"; $str .= fputs($fp, "."."\r\n")."\n"; $str .= fputs($fp, "QUIT"."\r\n")."\n"; echo fputs($fp, $str); fclose($fp); } ?> and I have checked the spam folder, but it empty
  7. When I try send email with PHPMailer_v5.1, it works. But when I try make it self, I know that the result is possible to error or email not sent. My problem is the email not sent. this my code: <?php $fp = fsockopen("ssl://smtp.gmail.com", 465, $errNo, $errStr, 15); if(!$fp){ echo "not connected"; }else{ fputs($fp, "EHLO"."\r\n"); fputs($fp, "AUTH LOGIN"."\r\n"); fputs($fp, base64_encode("author@gmail.com")."\r\n"); fputs($fp, base64_encode("password")."\r\n"); fputs($fp, "MAIL FROM:<author@gmail.com>"."\r\n"); fputs($fp, "RCPT TO:<target@gmail.com>"."\r\n"); fputs($fp, "DATA"."\r\n"); fputs($fp, "Subject: This is subject"."\r\n"); fputs($fp, "This is body message"."\r\n"); fputs($fp, "."."\r\n"); fputs($fp, "QUIT"."\r\n"); fclose($fp); } ?> And I have enable extension=php_openssl.dll in php.ini
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.