I recently recieved a script from this forum, which helped me out but I ran into some problems. I am trying to connect to smtp server and have no problem doing this. I am able to send the email but the email doesn't send any info (no subject, to, from etc). The problem is customizing the From, the To, Subject, Message along with other headers. I am not sure how to do this. Here is the code I am currently using:
$smtp = @fsockopen($myServer, $myPort, $errno, $errdesc, 30);
if(!$smtp)
{
print "Could not connect to SMTP server";
} else {
print fgets($smtp,1024);
echo "<br>";
$helo = fputs($smtp,"helo server\r\n");
print fgets($smtp,1024);
echo "<br>";
$send = fputs($smtp, "MAIL FROM: [email]me@mysite.com[/email]\r\n");
print fgets($smtp,1024);
echo "<br>";
$send2 = fputs($smtp, "RCPT TO: [email]you@yoursite.com[/email]\r\n");
print fgets($smtp,1024);
echo "<br>";
$send3 = fputs($smtp, "DATA\r\n");
print fgets($smtp,1024);
echo "<br>";
$test="Hello! Just testing!!\r\n";
echo "<br>";
$send4 = fputs($smtp, "$test\r\n.\r\n");
print fgets($smtp,1024);
echo "<br>";
fputs($smtp,"QUIT\r\n");
print fgets($smtp,1024);
echo "<br>";
}
This is probably simple to a lot of people but I am not famaliar with the smtp commands. Any help on this would be great.