I'm searching for mail sender script. I heard about PEAR and mail(). But this ways don't approach me because PEAR it's already third-party environment and mails which were sent by mail() function often goes to the spam.
I choosed sockets. I'd like to ask you: is it a good way or there are some better ways?
So an example of its using I found:
function socketmail($server, $to, $from, $subject, $message) {
$connect = fsockopen ($server, 25, $errno, $errstr, 30);
fputs($connect, "HELO localhost\r\n");
fputs($connect, "MAIL FROM: $from\n");
fputs($connect, "RCPT TO: $to\n");
fputs($connect, "DATA\r\n");
fputs($connect, "Content-Type: text/plain; charset=iso-8859-1\n");
fputs($connect, "To: $to\n");
fputs($connect, "Subject: $subject\n");
fputs($connect, "\n\n");
fputs($connect, stripslashes($message)." \r\n");
fputs($connect, ".\r\n");
fputs($connect, "RSET\r\n");
}
But it doesn't work. I'm asking for your help. And idk what to write in $server, for example if it is Gmail?