hi all;

I apreciate all the replies i had been read, but seems i got problem in sending an email,

well this is my problem. I could not display the proper format after i send the email.

Im looking into this kind of format after i send the email. this should be the ouput.

subject :  test
        From    : jhon stone [jhone@xxxxxxxxxxx.xxx]
        to         : reciepient
        

        message : this is only for testing.

here is the whole code that i made

class request {
	
	var $mail_id;
	var $email;
	var $name;
	var $address1;
	var $guestEmail;
	var $guestPhone;
	var $senderName;
	var $subject;
	var $message;
			
	function createHeader() {
	
        $from   = "From : $this->senderName <$this->guestEmail>\r\n";
        $input->header = $from;
        return $input->header;
    }
	 function send_email($input){
	 
        $input->createHeader();
		
        if (@mail($input->to, $input->subject, $input->message, $input->header)){
            
			return true;
        } else {
            return false;
        }
    }

Recommended Answers

All 4 Replies

I don't see an instantiation of any object into $input. Even if that is the reference you are sending into send_email(), you aren't going to be able to use that in createHeader() because it is out of scope.

Member Avatar for langsor

You do realize -- I hope -- that having a publicly accessible script that sends emails is a HUGE security risk on a server unless proper precautions are observed. It is an open doorway for DOS (Denial Of Service) attacks on the server (basically using all of its resources) and also to be used as a SPAM relay by anyone who finds it...

Just thought I'd point that out.

Having said all that, have you looked over the php.net mail() function definition and discussions?
http://us.php.net/manual/en/function.mail.php

Good luck

I don't see any evidence that this is a publicly accessible script. Its just a general mail class not much different than having a phpMailer class in your docroot. Its how you use it that matters. Just verify that a human is using your html form(commonly done with a random number generated within an image), validate all user input on the form handler that this html form submits to, validate all includes if you use a url query string to identify included files(I use a function to pull an array of file names from the subfolder in question and verify that the requested file is in that array), assign a value to all variables right when they are defined and turn off register globals for Christ's sake, you don't need them.

Member Avatar for langsor

Thanks R0bb0b,

I must be feeling paranoid today.. :-\

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.