Здравствуйте!
Написал отправку писем в зависимости от смены статуса заказа. Вот код который отправляет:
X++:
static server void sendMail(Notes _text,
Email _toEmail,
Name _fromName,
Email _fromEmail,
str _subject,
str _attachment = '')
{
EmailPriority priority = EmailPriority::High;
str attachmentPath = '';
SysEmailBatch sysEmailBatch;
;
if(!_toEmail)
return;
if (_attachment && WinAPI::fileExistsClient(_attachment))
attachmentPath = _attachment;
try
{
sysEmailBatch = SysEmailBatch::construct();
sysEmailBatch.parmSendername(_fromName);
sysEmailBatch.parmSenderAddr(_fromEmail);
sysEmailBatch.parmEmailAddr(_toEmail);
sysEmailBatch.parmMessageBody(_text);
sysEmailBatch.parmPriority(priority);
sysEmailBatch.parmSubject(_subject);
sysEmailBatch.parmAttachmentfileName(attachmentPath);
sysEmailBatch.run();
}
catch
{
}
}
Прописал в SysEmailParameters настройки почтового сервера (Exchange).
Все прекрасно работает для внутренней почты, а если попытаться отправить письмо на внешнюю почту - генерится исключение:
Метод 'SendMail' в COM-объекте класса 'Dundas.mailer' возвратил код ошибки 0x80004005 (E_FAIL), который означает: The RCPT command failed. The specified account does not exsist.
Поискал в интернете - нашел:
http://www.mail-archive.com/developm.../msg12537.html
We figured this out. On the Exchange server we had the IP addresses
of the AOS's in the SMTP Default Virtual Server properties (Relay
restrictions) but that does not work if you are emailing a report
because the ip address of the client is used. From our
understanding the AOS ip address is used when a batch job or if it
is running on the server side. So we entered in the range of our
Networks IP addresses and now it works great!
Передал админу - он не поймет как решить.
Не поможете разобраться?