943,871 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 533
  • PHP RSS
Aug 12th, 2008
0

send email

Expand Post »
hi all;

Quote ...
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.
Quote ...
Im looking into this kind of format after i send the email. this should be the ouput.
PHP Syntax (Toggle Plain Text)
  1. subject : test
  2. From : jhon stone [jhone@xxxxxxxxxxx.xxx]
  3. to : reciepient
  4.  
  5.  
  6. message : this is only for testing.

Quote ...
here is the whole code that i made
PHP Syntax (Toggle Plain Text)
  1. class request {
  2.  
  3. var $mail_id;
  4. var $email;
  5. var $name;
  6. var $address1;
  7. var $guestEmail;
  8. var $guestPhone;
  9. var $senderName;
  10. var $subject;
  11. var $message;
  12.  
  13. function createHeader() {
  14.  
  15. $from = "From : $this->senderName <$this->guestEmail>\r\n";
  16. $input->header = $from;
  17. return $input->header;
  18. }
  19. function send_email($input){
  20.  
  21. $input->createHeader();
  22.  
  23. if (@mail($input->to, $input->subject, $input->message, $input->header)){
  24.  
  25. return true;
  26. } else {
  27. return false;
  28. }
  29. }
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
god_1896 is offline Offline
39 posts
since Jul 2008
Aug 13th, 2008
0

Re: send email

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.
Last edited by R0bb0b; Aug 13th, 2008 at 1:01 am.
Reputation Points: 358
Solved Threads: 89
Posting Shark
R0bb0b is offline Offline
986 posts
since Jun 2008
Aug 13th, 2008
0

Re: send email

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
Last edited by langsor; Aug 13th, 2008 at 1:42 am.
Reputation Points: 30
Solved Threads: 36
Posting Whiz
langsor is offline Offline
389 posts
since Aug 2008
Aug 13th, 2008
0

Re: send email

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.
Reputation Points: 358
Solved Threads: 89
Posting Shark
R0bb0b is offline Offline
986 posts
since Jun 2008
Aug 13th, 2008
0

Re: send email

Thanks R0bb0b,

I must be feeling paranoid today.. :-\
Reputation Points: 30
Solved Threads: 36
Posting Whiz
langsor is offline Offline
389 posts
since Aug 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC