开发者

System.Diagnostics.Process.Start for mailto not working on test server

At the customers request (sadly) they want their request forms to prompt the local email client for the end user. They don't want to configure SMTP or anything on there end.

I've run into an issue where it works on my local IIS, but doesn't seem to run on our or test server at all. No error is presented in the log, and the compose email doesn't ever popup for sending.

Any ideas? I've looked at security and configuration, but haven't found any differences other than the OS itself. XP Pro -vs- Server.

var mailToLink = "mailto:" + (string)HttpContext.GetGlobalResourceObject ("Portal", "mailToUnInst") + "?subject=" + (string)HttpContext.GetGlobalResourceObject("Portal", "admnTitlUnInst") + " request for " + (string)HttpContext.GetGlobalResourceObject("Portal", "admnTerm") + " " + term.Text + " on " + dtUnInst.Text + "&body=";

mailToLink += (string)HttpContext.GetGlobalResourceObject("Portal", "admnTerm") + " " + term.Text + "%0D%0A"
                    + "%0D%0A"
                    + (string)HttpContext.GetGlobalResourceObject("Portal", "admnLoc") + " " + loc.Text + "%0D%0A"
                    + (string)HttpConte开发者_StackOverflow社区xt.GetGlobalResourceObject("Portal", "admnAddr1") + " " + addr1.Text + "%0D%0A"
                    + (string)HttpContext.GetGlobalResourceObject("Portal", "admnAddr2") + " " + addr2.Text + "%0D%0A"
                    + (string)HttpContext.GetGlobalResourceObject("Portal", "admnCity") + " " + city.Text + "%0D%0A"
                    + (string)HttpContext.GetGlobalResourceObject("Portal", "admnSt") + " " + st.Text + "%0D%0A"
                    + (string)HttpContext.GetGlobalResourceObject("Portal", "admnZip") + " " + zip.Text + "%0D%0A"
                    + "%0D%0A"
                    + (string)HttpContext.GetGlobalResourceObject("Portal", "admnAtmType") + " " + atm.Text + "%0D%0A"
                    + (string)HttpContext.GetGlobalResourceObject("Portal", "admnDtUnInst") + " " + dtUnInst.Text + "%0D%0A"
                    + (string)HttpContext.GetGlobalResourceObject("Portal", "admnRsn") + " " + resn.Text + "%0D%0A"
                    ;

try
{
    System.Diagnostics.Process.Start(mailToLink);
}
catch
{
  //error log process
}

All help greatly appreciated


First thing to try: what happens on the command line?

start mailto:foo@xyz.com

Does that start the mail client? If not, then it's nothing to do with .NET. (It doesn't work on my netbook either, but then I've never set up a mail client on there...)


Maybe I am getting this wrong, but do you want to call Process.Start on the server to start the user's local email client? This won't work (well, it works only if your web server is running on the local machine in the appropriate context); you should be using mailto-links in your pages:

<a href="mailto:user@example.com?subject=MySubject&body=Hello%20World">Click to send an email</a>

Update

They don't want to configure SMTP or anything on there end.

Without an SMTP server somewhere you won't be able to send email at all, no matter whether you are going to use an email client tool or the .NET classes. You should tell your client that configuration is required, possibly store the STMP server values in your web.config and send the email as described here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜