Api:Send Email to a specific email outside the supported type
The problem with the API:Send Email system is that you must set a related ID attributes. Therefor you simply can't send an email to a specific email address.
Let's say I want to send an email to "firstname.lastname@example.org" within a module. Just sending an email, not saving/logging them in the WHMCS database. This email is not part of one of the following email required type:
- General Email Type = Client ID (tblclients.id)
- Product Email Type = Service ID (tblhosting.id)
- Domain Email Type = Domain ID (tbldomains.id)
- Invoice Email Type = Invoice ID (tblinvoices.id)
- Support Email Type = Ticket ID (tbltickets.id)
- Affiliate Email Type = Affiliate ID (tblaffiliates.id)
And it shouldn't be as it's not part of any of them. So I can't have a "related ID" to use for the API which means it returns an error. I can see in the documentation that we can set Additional Attributes for Custom Email Messages (customtype, customsubject, custommessage). So I was thinking about a new attribute such as "customrecipient" or "customemail" to achieve this purpose.
The main idea is to not reinvent the wheel as the API is already doing this and it's just a matter of changing to whom the email is sent. It also can be great to have one unique way to send all the emails and not needing to manually setup phpMailer for these cases.