Forum Discussion

Belmontes's avatar
Belmontes
New Contributor
12 days ago

SendMail input string not in the form for an e-mail address

Hello everyone,

We recently made the jump from version 7 to 9, and a rule that was previously working is now throwing an error. We are trying to use the BRApi.Utilities.SendMail functionality after a certification is done through the DataQualityEventHandler, but OS is giving us the following message when executing the certification

The specified string is not in the form required for an e-mail address.

We verified the toEmailAddresses parameter is a List(Of String) with a single item in the format "user@mail.com". What can be causing this issue?

1 Reply

  • vasantharaidu's avatar
    vasantharaidu
    New Contributor III
    Dim requestor As UserInfo = BRApi.Security.Authorization.GetUser(si, userName)
    'Dim userEmail As String = requestor.User.Email
    
    Dim emails As New List(Of String)
    
    ' Support mailbox
    emails.Add("support@company.com")
    emails.Add("user1@company.com")
    emails.Add("user2@company.com")
    
    ' Requestor email
    If Not String.IsNullOrWhiteSpace(userEmail) Then
        emails.Add(userEmail)
    End If
    
    ' Optional: additional fixed recipients
    
    
    BRApi.ErrorLog.LogMessage(si, "Email Recipients: " & String.Join(";", emails))
    
    Dim mailThread As New Thread(Sub()
        Try
            BRApi.Utilities.SendMail(
                si,
                "OneStreamEmail",
                emails,
                emailSubject,
                mailBody.ToString(),
                True,
                Nothing
            )
    		

    Try with above