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, "alina@abcfoods.com.pk", "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!



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


Configure outgoing email for a SharePoint Server farm

  • I've already checked the Outgoing email settings & they are fine – Alina Anjum Jan 8 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_MSFT Jan 8 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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