0

I am trying to send email via SPUtility by trying the following code:

bool blnIsEmailServerSet = SPUtility.IsEmailServerSet(web);
bool IsSent;
SPSecurity.RunWithElevatedPrivileges(delegate ()
{
    IsSent= SPUtility.SendEmail(SPContext.Current.Web, true, true, "[email protected]", "subject", "body");  
});

refer to the following link: Send Email from SharePoint

but, blnIsEmailServerSet is always getting true while SPUtility.SendEmail is always returning False in IsSent variable.

what is the issue?

Kindly help!

Thanks.

1 Answer 1

0

Tested in my side and it is working with returned true bool value: enter image description here

And email can be got when checking Outlook:

enter image description here

I think you will need to check your Outgoing email settings in your environment,specify the valid SMTP Sever: enter image description here

Reference:

Configure outgoing email for a SharePoint Server farm

2
  • I've already checked the Outgoing email settings & they are fine Commented Jan 8, 2019 at 4:30
  • @AlinaAnjum, you could do a test with workflow sendmail action, check if the mails is working in your environment. This will help to narrow down the issue.
    – Jerry
    Commented Jan 8, 2019 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.