PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Mon Oct 22, 2018 8:27 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sun Aug 14, 2011 4:01 pm 
Offline
Forum Newbie

Joined: Sun Aug 14, 2011 1:28 pm
Posts: 8
Hello All :)
this my 2nd topic here
i've done a new class for sending msgs to email
anyways
this is the class :
Syntax: [ Download ] [ Hide ]
<?php

/**
 * @author ODAI
 * @copyright 2011
 * @contact dodi-505@hotmail.com
 */

class send_email{
/**     Sending info */
  private $from;
  private $to;
  private $subject;
 private $msg;
/**     4 params for sending info */
function __construct($to,$from,$sub,$msg)
{
    $this->from   =$from;
    $this->to     =$to;
    $this->subject=$sub;
    $this->msg    =$msg;
}
/**     function for Headers */
function Headers()
{
    $headers = "From:".$this->from . "\r\n";
    $headers .= "To:".$this->to . "\r\n";
    $headers .= "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
    $headers .= 'X-Mailer: PHP/' . phpversion();
    return $headers;
}
/**     function for sending the msg */
function send(){
    if(mail($this->to,$this->subject,$this->msg,$this->Headers()))
    {
    return "your msg has been sent to : <br />".$this->to ;
    }
}
}
?>
 

how to use :
Syntax: [ Download ] [ Hide ]
$n=new send_email("x@hotmail.com","x1@hotamil.com","Hello","title");
echo $n->send()
 

the first parm for the contact , 2nd for ur email , 3rd subject of ur msg , 4th for ur msg
this it
have a nice day :)


Top
 Profile  
 
PostPosted: Sun Aug 14, 2011 4:07 pm 
Offline
Forum Contributor

Joined: Thu Oct 23, 2008 4:43 pm
Posts: 245
You might want to post it here as that is the place for code critique, likely to get more responses over there (not to mention it belongs there).


Top
 Profile  
 
PostPosted: Sun Aug 14, 2011 4:09 pm 
Offline
Forum Newbie

Joined: Sun Aug 14, 2011 1:28 pm
Posts: 8
ah
other time :P
thanks for telling me


Top
 Profile  
 
PostPosted: Sun Aug 14, 2011 4:27 pm 
Offline
DevNet Master
User avatar

Joined: Sun Feb 15, 2009 12:08 pm
Posts: 2794
Location: .za
Good on starting with OOP stuff, if the class is to be taken more seriously you should look at using more the zend coding standards in terms of your comments for what each method does , etc.

_________________
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering


Top
 Profile  
 
PostPosted: Sun Aug 14, 2011 6:27 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13581
Location: New York, NY, US
Moved to Code Critique.

_________________
(#10850)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group