I’m sending E Mails with INDY 10 components with the following code :
try
MyNewIndyMessage.From.Address := edFrom.Text;
MyNewIndyMessage.Recipients.EMailAddresses := edTo.Text;
MyNewIndyMessage.CCList.EMailAddresses := edCC.Text;
MyNewIndyMessage.BCCList.EMailAddresses := edBCC.Text;
MyNewIndyMessage.Subject := edSubject.Text;
MyNewIndyMessage.Body := edContent.Lines;
MyIndySMTP.Send(MyNewIndyMessage);
finally
MyIndySMTP.Disconnect;
end;
Indy smtp requests me to enter a valid organisation in the Message.from.address like “myname@companyX.com” , I wouöld like to enter here and arbitray string like “This mail is urgent to read”.
Can I bypass such check done in my INDY SMTP components ?
According to the Internet Message Format specification (RFC 2822), the From field must contain a valid mailbox, which normally is (section 3.4):
An example of this may be like this:
As implied, mail clients usually display the (optional) name attribute if present, and the address itself if a name is not present.
In INDY terms, the TIdEMailAddressItem have three properties, which are always in sync:
Addressis the address-spec part of the mailbox, for example:john.doe@example.comNameis the name part of the mailbox, for example:John DoeTexthave both parts, for example:John Doe <john.doe@example.com>You can change one of that and the others will reflect the same changes.
So, you can do what you want by setting the Text property directly, like this:
Or you may want to set each one separately:
All this said, you may want to use that name as the subject (along with some more info), and not really as the name, but that’s up to you.