Question:
how to send email using php no mail function?
kty1104
2009-10-23 03:47:48 UTC
hi i set the my personal computer to web server i install the Apache2 PHP5 MySQL5 i want to make the webpage that can send mail to me so i my yahoo messanger let me know in realtime i used the mail function but it doesnt work could somebody let me know how to do that?
Three answers:
just "JR"
2009-10-23 05:17:34 UTC
On top of Php5 and mysql, you also have to install a mail server (SMTP), then you will be able to use the function mail()
garlick
2016-10-13 04:27:01 UTC
I even have been given this immediately "distant host stated: 550 SC-004 Mail rejected by potential of abode windows stay Hotmail for coverage motives. A block has been placed against your IP handle because of the fact we've gained complaints concerning mail coming from that IP handle. in case you at the instant are not an digital mail/community admin please touch your " I asked additionally immediately, then I in simple terms googled the message and located your message, please shop me as much as date. I have no thought why it is happening.
anonymous
2009-10-23 12:26:25 UTC
you will not be able to do it with out a mail server installed.

Here is a little script for mail though






/***********************

CLASS :: MYMail

************************/

class MyMail{

var $To;

var $ToSender;//If you want the email to go to the sender

var $Subject;

var $Msg;

var $Headers;

var $From;

var $ReplyTo;

/*

$headers = 'From: webmaster@example.com' . "\r\n" .

'Reply-To: webmaster@example.com' . "\r\n" .

'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

***&&&&&*******

For HTML Mail

'MIME-Version: 1.0' . "\r\n";

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

*/

function MyMail($To, $Subject, $Msg, $From, $ReplyTo){

$this->To=(empty($To)) ? "0" : $To;

$this->Subject=(empty($Subject)) ? "0" : $Subject;

$this->Msg=(empty($Msg)) ? "0" : $Msg;

$this->From=(empty($From)) ? "0" : $From;

$this->ReplyTo=(empty($ReplyTo)) ? "0" : $ReplyTo;

$this->Headers="MIME-Version: 1.0" . "\r\n" . "Content-type: text/html; charset=iso-8859-1" . "\r\n" . "From:" . $this->From . "\r\n" . "Reply-To:" . $this->ReplyTo . "\r\n" . "X-Mailer: PHP/" . phpversion();



//Use this array if you want to send to only one person

$SetMail=array(

'To'=> $this->To,

'Subject'=> $this->Subject,

'Msg'=> $this->Msg,

'Headers'=> $this->Headers,

'From'=> $this->From,

'ReplyTo'=> $this->ReplyTo

);

//Use this array if you want it to go to multiple people (the sender/CC:/Bcc:)

/*

$SetMail=array(

'To'=> $this->To . "," . $ToSender,

'Subject'=> $this->Subject,

'Msg'=> $this->Msg,

'Headers'=> $this->Headers,

'From'=> $this->From,

'ReplyTo'=> $this->ReplyTo

);

*/

if(in_array("0",$SetMail)){

echo "
Something wrong with the mail! Please make sure all fields are filled in!
";

return;

}

else{

if(!mail($SetMail['To'], $SetMail['Subject'], $SetMail['Msg'], $SetMail['Headers'])){

echo "";

}

}

}

}

?>



and call the class like this



$MyMail=new MyMail($To="Email address", $Subject="Subject", $Msg=Message or body, $From="From email address", $ReplyTo="reply to email address.or use from email address");


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...