Forum Discussion

jnr-O365's avatar
jnr-O365
Copper Contributor
Apr 04, 2019
Solved

Send an email from SPFx client-side webpart without exchange online

Hello All,

 

We're trying to build an spfx client-side webpart which should send a confirmation email to the user logged in (CC'in a mailbox) on a button click. I have tried Graph Api and pnp.js, and they both work great on my personal tenant where exchange online is enabled. But on our company prod tenant we do not have exchange online enabled. 

 

Any idea if GraphApi/PnP.js has a dependency on enabling exchange online to send email. 

 

Thank you all ! 

 

 

8 Replies

  • pallavisharma's avatar
    pallavisharma
    Copper Contributor

    jnr-O365 

    I am trying to use the GraphAPI for sending mail through SPFX : SendAs. But things are not working for me. PFB the code example. Could you please post a sample of what you have implemented.

    I have verified the 'SendAs' permission in EAC as well.

    The error that I am getting clearly depicts that it is a permission issue, but I am not able to figure out .

    "The user account which was used to submit this request does not have the right to send mail on behalf of the specified sending account".

     

    My code :

    Mail Message : 

    from:
    {
    emailAddress: { address: "shared-mailbox@domain.com" }
    }
     
    My Graph client : 
    const graphClient: MSGraphClient = await this.props.context.msGraphClientFactory.getClient();
    await graphClient
    .api(`users/admin@domain.com/sendMail`)
     
     
    Any guidance will be highly appreciated !
    • jnr-O365's avatar
      jnr-O365
      Copper Contributor
      pallavisharma: I think you can only send email to a valid SharePointOnline user when you're using mail end point in Graph. You may not be able to send emails to outlook mailbox.
  • Rajkiran_Swain's avatar
    Rajkiran_Swain
    Copper Contributor
    https://delucagiuliano.com/inviting-external-user-with-sharepoint-framework/#.XKj3qFUzbIU

Resources