Hi erverybody,
I am using 'system.web.mai' to send email in infopath 2007 form in sharepoint server 2008. I configured a virtual smtp server named "exlayer-demo1.exlayer-demo.local" in my windows server 2003. And I set Access Control Authetication and Delivery Outbound Security of my virtual smtp server to Anonymous Access, that means it's no 'user account & passwod' needed to send email using this virtual smtp server. When I sign in as an administrator user, everything works well, I can send a email by following code without any problem. But when I sign in as a normal user, I get a error message of 'An error occurred submitting this form to the Web server.' once I click the 'send email' button in my infopath form. And if I give this normal user to administraor access, this account becomes to be able to send email. So I think I have some wrong configrations in my infopath, sharepoint server or windows server, but I can't resove it for quite a long time.
By the way, I tried to use system.net.mail & Microsoft.SharePoint.Utilities.SPUtility.SendEmail to implement the sending email function, but nothing changes. And I also tried to change the properities of my virtual smtp server and the folder ' Inetpub\mailroot\', but the error message continues. Finally, I tried to change the configurations in the file 'C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG\wss_minimaltrust.config', but I still get the same error message. I am sure I have some wrong configurations around my infopath, sharepoint server or windows server 2003, but I can't find it out. Now, what I can do is just give all users in my domain to administrator access. If I do so, sending email function will be fine, but it's not security at all.
Did anybody have some ideas about this problem? Please give me some suggesstions, and I'll try everything you tell me. Any help is very appreciated.
Thank you so much!
void SendEmail(string touser, string ccuser, string fromuser, string mailsubject, string mailbody)
{
if ((touser == null) || (touser == ""))
{
return;
}
MailMessage MailMsg = new MailMessage();MailMsg.BodyFormat = MailFormat.Html;
MailMsg.Body = mailbody;
MailMsg.From = fromuser;
MailMsg.To = touser;
MailMsg.Subject = mailsubject;
MailMsg.Cc = ccuser;
SmtpMail.SmtpServer = "exlayer-demo1.exlayer-demo.local";
SmtpMail.Send(MailMsg);
}
Ye