Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Try this</strong></p> <p><strong>SMTPconfig.php</strong></p> <pre><code>&lt;?php //Server Address $SmtpServer="127.0.0.1"; $SmtpPort="25"; //default $SmtpUser="username"; $SmtpPass="password"; ?&gt; </code></pre> <p><strong>SMTPclass.php</strong></p> <pre><code>&lt;?php class SMTPClient { function SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body) { $this-&gt;SmtpServer = $SmtpServer; $this-&gt;SmtpUser = base64_encode ($SmtpUser); $this-&gt;SmtpPass = base64_encode ($SmtpPass); $this-&gt;from = $from; $this-&gt;to = $to; $this-&gt;subject = $subject; $this-&gt;body = $body; if ($SmtpPort == "") { $this-&gt;PortSMTP = 25; } else { $this-&gt;PortSMTP = $SmtpPort; } } function SendMail () { if ($SMTPIN = fsockopen ($this-&gt;SmtpServer, $this-&gt;PortSMTP)) { fputs ($SMTPIN, "EHLO ".$HTTP_HOST."\r\n"); $talk["hello"] = fgets ( $SMTPIN, 1024 ); fputs($SMTPIN, "auth login\r\n"); $talk["res"]=fgets($SMTPIN,1024); fputs($SMTPIN, $this-&gt;SmtpUser."\r\n"); $talk["user"]=fgets($SMTPIN,1024); fputs($SMTPIN, $this-&gt;SmtpPass."\r\n"); $talk["pass"]=fgets($SMTPIN,256); fputs ($SMTPIN, "MAIL FROM: &lt;".$this-&gt;from."&gt;\r\n"); $talk["From"] = fgets ( $SMTPIN, 1024 ); fputs ($SMTPIN, "RCPT TO: &lt;".$this-&gt;to."&gt;\r\n"); $talk["To"] = fgets ($SMTPIN, 1024); fputs($SMTPIN, "DATA\r\n"); $talk["data"]=fgets( $SMTPIN,1024 ); fputs($SMTPIN, "To: &lt;".$this-&gt;to."&gt;\r\nFrom: &lt;".$this-&gt;from."&gt;\r\nSubject:".$this-&gt;subject."\r\n\r\n\r\n".$this-&gt;body."\r\n.\r\n"); $talk["send"]=fgets($SMTPIN,256); //CLOSE CONNECTION AND EXIT ... fputs ($SMTPIN, "QUIT\r\n"); fclose($SMTPIN); // } return $talk; } } ?&gt; </code></pre> <p><strong>index.php</strong></p> <pre><code>&lt;?php include('SMTPconfig.php'); include('SMTPClass.php'); if($_SERVER["REQUEST_METHOD"] == "POST") { $to = $_POST['to']; $from = $_POST['from']; $subject = $_POST['sub']; $body = $_POST['message']; $SMTPMail = new SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body); $SMTPChat = $SMTPMail-&gt;SendMail(); } ?&gt; &lt;form method="post" action=""&gt; To:&lt;input type="text" name="to" /&gt; From :&lt;input type='text' name="from" /&gt; Subject :&lt;input type='text' name="sub" /&gt; Message :&lt;textarea name="message"&gt;&lt;/textarea&gt; &lt;input type="submit" value=" Send " /&gt; &lt;/form&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload