Custom Messaging System

Hi there.

I am currently working on a custom in-house messaging system which will allow you to send a message to up to 10 other users. I can get messages to send and be received no problem. My issue is with multiple recipients.

All the users are stored on a database with a unique ID number and username. The ‘send message’ form, has 3 fields: recipient, subject and message. The messages are also stored on the database.

Is there a way I can input multiple usernames into the recipient field, separated by a comma, rather than keep adding another field for each recipient?

Multi-step process:

1 - explode the to field
2 - count the number of entries in [ 0 ]
3 - if count is more than 1, use a loop and put all the associated email addresses in an array
4 - loop through the array, sending the message to everyone individually.
4.1 - if the count is 1, skip the array, run the query to get the email and send the message.

Your headers, subject and message are outside of this loop

Sponsor our Newsletter | Privacy Policy | Terms of Service