In an application developed with Borland C++Builder 6, I am using TIdSMTP
and TIdMessage
to send email messages. Due to problems for external applications with the usual mail server in the configuration, I am defining the connection data through my Gmail account as follows:
Correo->From->Address = "******@******.org";
Correo->ReplyTo->EMailAddresses = "******@******.org";
Correo->From->Name = "*******";
Correo->Organization = "*******";
Enviar->Host = "smtp.gmail.com";
Enviar->Password = "******";
Enviar->Port = 465;
Enviar->Username = "******@gmail.com";
Enviar->UseTLS = utUseImplicitTLS;
SSLIOHandler->Port = 465;
SSLIOHandler->Host = "smtp.gmail.com";
SSLIOHandler->Destination = "smtp.gmail.com:" + IntToStr(SSLIOHandler->Port);
SSLIOHandler->SSLOptions->Method = sslvTLSv1_2;
SSLIOHandler->SSLOptions->Mode = sslmUnassigned;
The emails are sent without any problem, but I am checking that in addition to the copies that I send one to my Gmail address. I have verified that the Gmail address appears in the message headers in the Return-Path
field.
I have been looking and, at least in Indy 10 for BCB 6, I have not found how to modify that field. How can I get copies to only reach the address indicated in the ReplyTo
field of TIdMessage
?
The
TIdMessage.ReplyTo
property has no effect on theReturn-Path
header. TheReplyTo
is only used for theReply-To
header, which recipients use to reply back to the sender. TheReply-To
header is not used by the receiving SMTP server at all.The
Return-Path
header is generated by the receiving SMTP server using the address specified in the sending client's SMTPMAIL FROM
command. You can specify that address in theTIdMessage.Sender
andTIdMessage.From
properties (in that order), or by using one of the other overloadedTIdSMTP.Send()
methods that has anAFrom
parameter.