Synapse BCC lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- cappe · 2023-03-31 12:52 Hi, I found a solution that seems to work for BCC with synapse.     EncodeMessage; // after this procedure     Header.ToList.Add(Bcc); // here I put the Bcc and it seems to work ---------------------------------------------------------------------- paweld · 2023-03-31 13:17 if you do it this way, the recipients will see the BCC address on the list.  I send it this way: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button1Click(Sender: TObject);var  sl_text, sl_html: TStringList;  MimeMsg: TMimeMess;  SMTPSend: TSMTPSend;  MIMEPart, MIMEPart2, HTMLPart: TMimePart;  i: Integer;begin  sl_text := TStringList.Create;  sl_text.Text := 'Hello world';  sl_html := TStringList.Create;  sl_html.Text := 'Hello world
Zażółć gęślą jaźń';  MimeMsg := TMimeMess.Create;  SMTPSend := TSMTPSend.Create;  try    MimeMsg.Header.From := 'Test ';    MimeMsg.Header.ToList.Add('user1@another- domain.com');    MimeMsg.Header.ToList.Add('user2@another- domain.com');    MimeMsg.Header.CCList.Add('copy@another- domain.com');    MimeMsg.Header.Subject := 'Test message';    MimeMsg.Header.Priority := MP_high;    MimeMsg.Header.CustomHeaders.Add('Disposition-Notification-To: ' + MimeMsg.Header.From); //read confirmation    MimeMsg.Header.Date := Now;    MimeMsg.Header.XMailer := 'lazarus';    MimeMsg.Header.CharsetCode := UTF_8;    MimeMsg.Header.ReplyTo := 'Test ';    MIMEPart := MimeMsg.AddPartMultipart('related', nil);    MIMEPart.CharsetCode := UTF_8;    HTMLPart := MimeMsg.AddPart(MIMEPart);    HTMLPart.ConvertCharset := False;    with HTMLPart do    begin      sl_html.SaveToStream(DecodedLines);      Primary := 'text';      Secondary := 'html';      Description := 'HTML text';      Disposition := 'inline';      CharsetCode := UTF_8;      EncodingCode := ME_QUOTED_PRINTABLE;      EncodePart;      EncodePartHeader;    end;  MIMEPart2 := MimeMsg.AddPartMultipart('alternative', MIMEPart);    MIMEPart2.CharsetCode := UTF_8;    MimeMsg.AddPartTextEx(sl_text, MIMEPart2, UTF_8, True, ME_8BIT); //add alternative text message    MimeMsg.EncodeMessage;    SMTPSend.TargetHost := 'smtp.example.com';  SMTPSend.TargetPort := '587';    SMTPSend.UserName := 'test@example.com';    SMTPSend.Password := 'myemailpassword';    SMTPSend.AutoTLS := False;    SMTPSend.FullSSL := False;    if SMTPSend.Login then    begin      if SMTPSend.AuthDone then      begin        SMTPSend.MailFrom(email, Length(MimeMsg.Lines.Text));      for i := 0 to MimeMsg.Header.ToList.Count - 1 do  //TO          SMTPSend.MailTo(MimeMsg.Header.ToList[i]);        for i := 0 to MimeMsg.Header.CCList.Count - 1 do  //CC          SMTPSend.MailTo(MimeMsg.Header.CCList[i]);        SMTPSend.MailTo('admin@example.com');  //BCC        if SMTPSend.MailData(MimeMSg.Lines) then        begin          SMTPSend.Logout;          Caption := 'ok';        end        else        Caption := 'message error: ' + SMTPSend.ResultString;      end    else        Caption := 'auth error: ' + SMTPSend.ResultString;    end    else      Caption := 'login error: ' + SMTPSend.ResultString;  finally    FreeAndNil(MimeMsg);    FreeAndNil(SMTPSend);  end;  sl_text.Free;  sl_html.Free;end; ---------------------------------------------------------------------- Thaddy · 2023-03-31 14:32 Quote from: cappe on March 31, 2023, 02:52:05 pmand it seems to work Never, ever, take shortcuts like that. BCC is meant to be a private, one way, notification.