send multiple emails

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
Danny
User
Posts: 139

send multiple emails

Post by Danny »

Hi,

We try to send multiple emails of a selected database to all recipients.

Now we use:

sBBC = abc = ew_Execute("SELECT emailfield FROM <Table> WHERE emailfield <> '' ")

All emailaddresses has an ; at the end.

We get an error:

The parameter 'addresses' cannot be an empty string.

Line 5481: string[] arBcc = sBccEmail.Split(new char[] {';'});
Line 5482: foreach (string strBcc in arBcc)
Line 5483: mail.Bcc.Add(strBcc);


vincenthung
User
Posts: 88

Post by vincenthung »

Please note that ew_Execute() returns an integer. You may consider to use "ew_ExecuteRows" which will return a list Of OrderedDictionary. Then you can loop through the list and call the AddBcc() method of the Email object.


Webmaster
User
Posts: 9430

Post by Webmaster »

Make sure that you remove the last semi-colon (";") at the end of the email addresses (i.e. "mail1@domain;mail2@domain;...;mailn@domain")

Post your complete code for discussion.


Danny
User
Posts: 139

Post by Danny »

Hi,

This is the code:

Dim sSender As String, sRecipient As String, sCc As String, sBcc As String, sSubject As String, sContent As String, sFormat As String, sCharset As String
sSender = <emailaddress-sender>
sRecipient = ""
sCc = ""
sBcc = ew_ExecuteScalar("SELECT <emailaddress> FROM <customers>")
sSubject = "<subject>"
sContent = "<content>"
sFormat = "html"
sCharset = "utf-8"
ew_SendEmail(sSender, sRecipient, sCc, sBcc, sSubject, sContent, sFormat, sCharset)

The problem is the BCC executeScalar.

Regards,


Webmaster
User
Posts: 9430

Post by Webmaster »

As explained:
Make sure that you remove the last semi-colon (";") at the end of the email addresses (i.e. "mail1@domain;mail2@domain;...;mailn@domain")

For example:
If Right(sBcc,1) = ";" Or Right(sBcc,1) = "," Then sBcc = Mid(sBcc,1,Len(sBcc)-1) ' Remove last ";" / ","


Post Reply