How to set Email Sender from NAV/BC ? (other than from user id in SMTP Setup)

Hi All,
how to send email notification from dynamic senders instead of Admin email pulled from SMTP Mail setup

          ('NAV Admin',
          '', //Sender
          '', //Recipient
          'Test Send Email',
          'Hi This is only for testing',

this is my code.
at the sender part usually I pulled from SMTPsetup.“user id”.
but i need to pull from other email
can we do that?


Hi Stan,

Well it depends on what you wanna do.

Sending mail with SMTP is different from using MAPI. With SMTP you can specify which email should be used as the sender, just has you have done in your example. The email in the smtp setup, is the one used to login to the SMTP server. And sometimes there may be restrictions setup in the SMTP server, where you cannot send on behalf of other users.

So just replace the whoeversendthis email account with whatever, could be from the email in the user table. It it doesn’t work, then it’s most likely due to the configuration of the SMTP server, not NAV/BC.

There are two ways of sending mails from NAV/BC - either with OUTLOOK or without (called SMTP). If a mail is sent from OUTLOOK then it is possible to have different senders - from SMTP there is only one. And that is the one added to then SMTP Setup page.

This is for security/Safety reasons. Mostly because sending from SMTP requires a userid and a password. So you can say if you want to send an email with a specific users mail-account then you have to know the password of that user. This is obviously not a good idea.

You can ofcourse create a new table and a page with different mail-accounts and passwords - but I would strongly advise against it for security reasons.

Hi Erik, thanks for the reply. I have multiple users. so what i want is if user A send to B

then sender will be A (instead of Admin email that user filled up in the SMTP Setup)

Hi Palle, thanks for the reply.

how do i use outlook instead of SMTP?