var fieldList: TclMailHeaderFieldList; ind: Integer; subject: string; begin //load a message in a raw format. clSmtp1.MailData.LoadFromFile('mailmessage.eml'); //set up the TclSmtp component clSmtp1.Server := 'mail.example.com'; clSmtp1.UserName := 'user'; clSmtp1.Password := 'secret'; //specify the desired character set and MIME encoding for the Subject header field fieldList := TclMailHeaderFieldList.Create('utf-8', cmQuotedPrintable, DefaultCharsPerLine); try //parse the mail header fieldList.Parse(0, clSmtp1.MailData); //get an index of the Subject field ind := fieldList.GetFieldIndex('Subject'); //get the Subject field value subject := fieldList.GetDecodedFieldValue(ind); //modify the subject line subject := subject + ' modified...'; //remove the subject field from the clSmtp1.MailData string list fieldList.RemoveField(ind); //add an updated subject line fieldList.AddEncodedField('Subject', subject); //starting from now, the clSmtp1.MailData property contains the updated Subject field finally fieldList.Free(); end; //send the message clSmtp1.Send(); end;
Trouble logging in? Simply enter your email address OR username in order to reset your password.
For faster and more reliable delivery, add admin@clevercomponents.com to your trusted senders list in your email software.