Knowledgebase: FAQ
6.x Wrong FROM with SMTP client send mode?
Posted by Alexander Alexeev on 19 October 2011 10:00

Problem:

FROM field can be different from specified in settings. Thus, my SMTP server denies sending because FROM field doesn't match account name.

Reason:

This is as designed behaviour. Sender address is specified in settings, but can be changed at run-time. You can use MS Classic style dialog to show e-mail input box for user to specify his e-mail. This e-mail will be used for sending e-mails. Usually, this is useful, because you can see user e-mail in your e-mail client. This works well for all other e-mail send modes. However, SMTP client mode could be a problem, because not all SMTP servers allow you to send e-mails not from your name.


Solution:

If you don't want to e-mail address to be changed at run-time - you can specify this behaviour by using such code:

procedure TForm1.EurekaLog1ExceptionActionNotify(EurekaExceptionRecord: TEurekaExceptionRecord; EurekaAction: TEurekaActionType; var Execute: Boolean);
begin
if EurekaAction = atSendingEmail then
EurekaExceptionRecord.CurrentModuleOptions.SMTPFrom := CurrentEurekaLogOptions.SMTPFrom;
end;


This code uses OnExceptionActionNotify event - see help for its description. Code changes currently used e-mail settings to defaults as specified in project options.


See also:

  • http://www.eurekalog.com/docs/exceptionactionnotifyhowto.html
  • http://news.eurekalog.com/showthread.php?t=2775
  • http://news.eurekalog.com/showthread.php?t=2863

Help Desk Software by Kayako Resolve