我在我的企業有代理,我想測試代碼X ++來連接互聯網併發送電子郵件。用x ++配置代理
我不知道我能做些什麼來配置Dynamics AX中或代理哪一行代碼X ++我可以添加到我的梅索德:
void SendMail()
{
System.Net.Mail.MailMessage mailMessage;
System.Net.Mail.Attachment attachment;
System.Net.Mail.AttachmentCollection attachementCollection;
System.Net.Mail.SmtpClient smtpClient;
System.Net.Mail.MailAddress mailAddressFrom;
System.Net.Mail.MailAddress mailAddressTo;
str Body;
str Subject;
str SMTPServer;
str FileName;
str psw;
str login;
System.Net.Mail.SmtpDeliveryMethod stmpDeliveryMethod;
System.Net.WebProxy proxy;
ProxyIPAddress proxyIPAddress;
ProxyPortNum proxyPortNum;
System.Net.Sockets.Socket socket;
System.Net.NetworkCredential cred;
;
login ="[email protected]";
psw="mypassword";
mailAddressFrom = new System.Net.Mail.MailAddress("[email protected]","");
mailAddressTo = new System.Net.Mail.MailAddress("[email protected]","");
Body = "<B>Body of the email</B>";
Subject = "Subject line for the email";
//SMTPServer = SysEmailParameters::find(false).SMTPRelayServerName;
mailMessage = new System.Net.Mail.MailMessage(mailAddressFrom, mailAddressTo);
mailmessage.set_Subject(Subject);
mailmessage.set_Body(Body);
cred = new System.Net.NetworkCredential(login, psw);
smtpClient = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587);
smtpClient.set_EnableSsl(true);
stmpDeliveryMethod = ClrInterop::parseClrEnum('System.Net.Mail.SmtpDeliveryMethod', 'SpecifiedPickupDirectory');
smtpClient.set_DeliveryMethod(stmpDeliveryMethod);
//smtpClient.DeliveryMethod()= System.net.mail.SmtpDeliveryMethod.Network);
smtpClient.set_UseDefaultCredentials(false);
smtpClient.set_Timeout(20000);
smtpClient.set_Credentials(cred); //.Credentials = cred;
proxy=new System.Net.WebProxy();
print 'On va envoyer! remarque : next msg est : "sa marche" ';
smtpClient.Send(mailMessage);
print 'sa marche';
//////////////////////////////////////////
CodeAccessPermission::revertAssert();
}
例如,我配置Firefox的代理parametre或Internet Explorer可以連接互聯網!我指定IP 192.168.66.33和端口1234!並在動態斧頭我不能這樣做!
在c#w ^編輯web.config文件:
我們在應用程序的web.config文件中添加這一點。
在Dynamics AX的是我們可以改變?!!
的Rq:
例如我在Firefox或Internet Explorer配置代理服務器的parametre到可以連接互聯網!我指定IP 192.168.66.33和端口1234!並在動態斧頭我不能這樣做!
在c#w ^編輯web.config文件:
我們在應用程序的web.config文件中添加這一點。
<system.net>
<defaultProxy>
<proxy proxyaddress="YourProxyIpAddress"/>
</defaultProxy>
</system.net>
動態ax我們可以改變什麼?
考慮改善你的問題,因爲它不清楚。你的目標是什麼?你有什麼問題?任何錯誤消息?代理什麼? –
有人可以看到這個鏈接:我不明白,但我認爲這是解決方案http://www.komkid.net/2010/01/axapta-firewall-config/ –
您的代理設置在Firefox或Internet Explorer是一個http代理,這是smtp。你確定這是你想要做的嗎? – AnthonyBlake