Email - from and Return-Path error |
[eluser]dee_smart[/eluser]
Hi there, I have recently joined codeigniter and things have been going smooth so far. I noticed an elementory problem today in Email class. The problem is with the from($from, $name = '') function of the email class. These are the parameters I am passing to "from()" function: $this->email->from('[email protected]', 'mysitename.net'); In from function in Email Class $this->_set_header('From', $name.' <'.$from.'>'); $this->_set_header('Return-Path', '<'.$from.'>'); Here codeigniter is setting the headers for the email by passing values to array _headers. and it should show me an output [From] =>"mysitename.net" <[email protected]> [Return-Path] => <[email protected]> but it is showing me this: Array ( [From] =>"mysitename.net" [Return-Path] => ) I feel the problem is with ' <' , whenever i put this it does not parse the value of $from. Why does it behave like this? do you have any patch to fix this. I need to pass the Return-Path value to ensure the emails do not land in spam folder. Thanks for helping me fix this!
[eluser]Derek Allard[/eluser]
Take a look though http://ellislab.com/codeigniter/user-gui...email.html. You'll see that the CI way of adding the from (and return path) is Code: $this->email->from('[email protected]', 'Your Name'); You can also do a $this->email->reply_to() if that's helpful. The options are all down at the bottom under "Email Function Reference". Oh, and welcome to CI! You're going to love it.
[eluser]dee_smart[/eluser]
Thanks for the reply. I have gone through the manual already. and i am using $this->email->from(’[email protected]’, ‘sitename’); The problem is that it doesnt set a value for ’Return-Path’. and most of the email servers tag mails without return-path as spam.
[eluser]Derek Allard[/eluser]
Sorry, I misunderstood. I'll need to go through the code more carefully, but a quick look seems to indicate that mine is setting, and I just tested it on my server and its setting correctly.
[eluser]dee_smart[/eluser]
Is there a direct way to set the return-path? It always shows me a blank entry for return path in $this->email->print_debugger(), I checked the code, the problem is with '<' as I have mentioned in my first post.
[eluser]Chee Wai[/eluser]
[quote author="dee_smart" date="1197591493"]Is there a direct way to set the return-path? It always shows me a blank entry for return path in $this->email->print_debugger(), I checked the code, the problem is with '<' as I have mentioned in my first post.[/quote] Old topic, but for those who may be interested: Likely you didn't see the addresses within the < and > because you are looking directly at the web page and the < > are treated as html tags, use the view source function of your browser. Recently, i needed the Email class to support return paths for bounce handling So I added this function to the Email class: Code: function return_path($returnpath) This will allow setting of return path, just ensure you call it after you call the "from" function so that it doesn't get overwritten. In addition, the 3 lines for actual sending via mail/sendmail/smtp are admended to use Return path instead of From: Code: >> change
[eluser]sophistry[/eluser]
hi Chee Wai, typically, a hard-working,generous dev such as yourself creates a MY_Email.php file... ![]() here are two other threads discussing this issue with Return-Path: http://ellislab.com/forums/viewthread/122352/ http://ellislab.com/forums/viewthread/124105/ i'd classify it as a feature-request, not a bug. that said, i'd like to try out your new feature! cheers. |
Welcome Guest, Not a member yet? Register Sign In |