If the configuration variables admin_email1 and
admin_email2 are left blank, ORS tries to send mail to
the addresses 'admin_email1' and 'admin_email2' anyway.
It should probably instead send no mail when these
variables are null.
We should add a test in our send mail function which looks
at the to field and, if it is empty (except for commas,
which might end up in there depending on how the string is
put together) then it doesn't send the message.
if (str_replace(",","",$to)=="") return();
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When I coded the e-mail announcement feature I checked to
make sure that getcontact() for a given user didn't return a
blank string before I tried to send an email to that user. I
think it's a good idea that sendemail() should check for a
blank string itself, but I don't think that sendemail() should be
called when we aren't sure that we are sending a reasonable
parameter to it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It seems to me that, from an object-oriented point of view,
the issues relating to whether or not there is sufficient
information to send an e-mail should be the responsiblity of
sendemail()? That way the tests for validity are all in one
place and can be easily adapted as necessary.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=713937
We should add a test in our send mail function which looks
at the to field and, if it is empty (except for commas,
which might end up in there depending on how the string is
put together) then it doesn't send the message.
if (str_replace(",","",$to)=="") return();
Logged In: YES
user_id=829347
When I coded the e-mail announcement feature I checked to
make sure that getcontact() for a given user didn't return a
blank string before I tried to send an email to that user. I
think it's a good idea that sendemail() should check for a
blank string itself, but I don't think that sendemail() should be
called when we aren't sure that we are sending a reasonable
parameter to it.
Logged In: YES
user_id=713937
It seems to me that, from an object-oriented point of view,
the issues relating to whether or not there is sufficient
information to send an e-mail should be the responsiblity of
sendemail()? That way the tests for validity are all in one
place and can be easily adapted as necessary.
Logged In: YES
user_id=829347
Good point. I support your recommended course of action.