Please be patient, I'm brand new to trying to understand both .NET and CLR. I found the code in the database for sending SMTP mail using .NET and it's been running for me for a while very successfully. Of course, now we need to modify it by sending TO more than one person. It will currently only send to a single email address, even if more than one address is listed.
MailAddress_From = ObjectClrNew( "System.Net.Mail.MailAddress", "FromA@email.com" ) will work
MailAddress_From = ObjectClrNew( "System.Net.Mail.MailAddress", "FromA@email.com, FromB@email.com" ) will work BUT only "FromB" will actually be sent
Searching on StackOverflow I've found both the .To.Add and .Collection commands but when I try to use either I always get an error 1848: CLR: Type name not found. Could I get some help in figuring out how to add the second To address?
Thanks for any help!
The "To" property of the "MailMessage" object returns a collection so to add an additional "to" address you need to call the collection's "Add" method:
MailMessage = ObjectClrNew( 'System.Net.Mail.MailMessage', MailAddress_From, MailAddress_To )
MailAddress_To2 = ObjectClrNew( 'System.Net.Mail.MailAddress', 'guesswho@winbatch.com' )
MailMessage.To.Add(MailAddress_To2)
Thank you so much!
You were almost there already.