Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Send Message With Attachment

Good Day


I am looking to Send a message with an attachment from my AddOn code to a recipient.

For now, I am just trying to send it to myself here internally. I have spent time in the Help, Sample and the forum

with no luck. The Messages object and the Messages Services and I cannot get the code to send an e-mail.

Now, my SBO Mailer service is started in the SAP B1 Serve Suite Manager.

Here is my code for the oMessages object. This adds without error but I never get the e-mail. Is there somewhere I can check to see if the email got lost?

Dim lErrCode As Long

Dim sErrMsg As String

lErrCode = Nothing

sErrMsg = ""

Dim msg As SAPbobsCOM.Messages

msg = g_B1Connection.Company.GetBusinessObject(BoObjectTypes.oMessages)

msg.MessageText = "This is the content of message"

msg.Subject = "Hello manager"

Call msg.Recipients.Add()

msg.Recipients.UserCode = "manager"

msg.Recipients.NameTo = "manager"

msg.Recipients.SendEmail = BoYesNoEnum.tYES

msg.Recipients.EmailAddress = "<email address>"

Call msg.Attachments.Add()

msg.Attachments.Item(0).FileName = "C:\NextBPCode.txt"


g_B1Connection.Company.GetLastError(lErrCode, sErrMsg)

If lErrCode = 0 Then


UpdateStatus("Error sending email..." & sErrMsg & "", SAPbouiCOM.BoStatusBarMessageType.smt_Error)

End If

Any help is appreciated as I have spent way too much time so far on this issue.



Former Member
Not what you were looking for? View more on this topic or Ask a question