Graphql image

Send Email to Friend with GraphQL Mutation is used to send emails to a specific recipient with product details and your message. As a best magento development company in USA we are providing queries which will help you in development into your website.

By Default Email to Friend Setting is disabled and you want to try to run mutation, the response will throw an error, “Email to a Friend” is not enabled.

For functionality to works well, You must activate settings from the admin configuration,
Stores > Configuration > Catalog > Email to a friend > Enabled Yes Save Config.


GraphQL Mutation,

mutation {
sendEmailToFriend(
input: {
product_id: 2
sender: {
name: “Savan”
email: “savan.padaliya@nettyfy.mobiginie.com”
message: “I will just sending you a product”

}
recipients: [,br> { name: “test”, email: “test@nettyfy.mobiginie.com ” }
{ name: “test2”, email: “test2@nettyfy.mobiginie.com ” }
]
}
)
{
sender {
message
name
}
recipients {
name
}

}

}

product_id attribute used the real product id you want to display in the mail. Its a mandatory to defined the mutation.

sender attribute field will be your name and email of the sender, the message is the text you want to send in the mail. All the fields are mandatory as defined in the mutation.

recipients attribute used to send email to a friend, you can send single or multiple emails in the attribute. name and email of the recipient must be mandatory.