Search code examples
c#emailthunderbirdemail-client

How to include the user signature in the email body when sending a customized email through Thunderbird, using C# 3.5?


We need to send email from our desktop application using C# 3.5. The requirement is to send the new email using the Thunderbird, not directly from our application. So we are setting certain properties for the new email like emialfrom, emailto, subject, body & attachments through code, we save it as an .eml file & then we open that .eml file in thunderbird using code: The logic we are following is:

MyEmailClass eml = new MyEmailClass();
eml.Subject = "subject";
eml.SetHtmlBody(" email body");
eml.From = "from";
email.AddTo = "[email protected]";
email.AttachmentPath = "attachmentpath";

email.SaveEml("myEmail.eml");

So now we have the the .eml file & we need to open it in the Thunderbird, we are using System.Diagnostics.Process.Start to open the eml file in Thunderbird:

System.Diagnostics.Process.Start(thunderbird exe path,myEmail.eml path);

The above works fine, however we have just one issue, the sender signature is not shown when the email opens in the Thunderbird.

Facts:

1- The user has valid signature associated with his account.

2- We are using Thunderbird 8.0

3- We are using C# 3.5

4- Thunderbird is the default email client on users systems.


Solution

  • Signatures are added by the email client when it creates the email body. Since you are creating the email body through code, you would have to programmatically insert the signature. Just to be clear, you are not necessarily launching thunderbird on the user's machine, you are launching whatever process is associated with the .eml file extension. If you want to include the singature from Thunderbird, you could look to see if any of their APIs help, but they look like they haven't been updated in years. You could also give your users the option of setting up their signature within your application.