peacecodotnet
Programmer
I like to fool around with PHP on my server, and I'm trying to connect to the mail port of my server (port 25). The code that I have is as follows:
This should send me an email at me@mywebsite.com, and the from address should be bla@bla.com.
However, when I run this, it gives me an error that the connection was refused. How do I fix this?
Thanks in advance!
Peace out,
Peace Co.
Code:
<?php
$fp = fsockopen("[URL unfurl="true"]www.mywebsite.com",[/URL] 25, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "MAIL FROM: bla@bla.com.com\r";
$out .= "RCPT TO: me@mywebsite.com\r";
$out .= "DATA\r";
$out .= "Testing 1 2 3\r";
$out .= ".\r";
fwrite($fp, $out);
fclose($fp);
}
?>
This should send me an email at me@mywebsite.com, and the from address should be bla@bla.com.
However, when I run this, it gives me an error that the connection was refused. How do I fix this?
Thanks in advance!
Peace out,
Peace Co.