Using MailChimp for .NET sending mails to bcc - c#

I'm using MailChimp for .NET sending mails, but the wrapper for the recipient doesn't contain a type, which the is necessary for sending massmails.
MailChimp.Types.Mandrill.Messages.Recipient recipient = new MailChimp.Types.Mandrill.Messages.Recipient(member.EMail, member.Name);
Is it me who has missed something?

Quoted from MailChimp. Scroll down to "Tips for creating your HTML Campaign".
MailChimp does not use a BCC field as each recipient on your list is hidden from all other recipients on your list. We deliver a completely separate copy of your email to each recipient on your list, allowing you to personalize your content for each recipient, track clicks and opens, and address each email to the recipient's name.

I decided to use MCAPI.NET and changed the source adding a attribute to Recipient with name "to".
Setting this attribute to value "BCC" solved the problem.
Note : MailChimp is a Newsletter sending software where Mandrill is a transactional mail sending component.

Related

Sending buttons in email in c#

I want to send two buttons in email. On clicking of that buttons user should be able to Approve or Reject approval. It should work on gmail as well as outlook. I am not sure if web api will work. I am using c# for sending email. Please share any idea.
Email clients (Outlook as well) don't allow executing any JavaScript code in the message body for security reasons. The best what you could do for all mail clients is to paste a hyperlink in the message body and count responses on the server side when users click it.
As for for Outlook, you can use the MailItem.VotingOptions property which allows setting a string specifying a delimited string containing the voting options for the mail message.
Voting options on messages are used to give message recipients a list of choices and to track their responses. To create voting options programmatically, set a string that is a semicolon-delimited list of values for the VotingOptions property of a MailItem object. The values for the VotingOptions property will appear under the Vote command in the Respond group in the ribbon of the received message.
using Outlook = Microsoft.Office.Interop.Outlook;
private void OrderPizza()
{
Outlook.MailItem mail = (Outlook.MailItem)Application.CreateItem(
Outlook.OlItemType.olMailItem);
mail.VotingOptions = “Cheese; Mushroom; Sausage; Combo; Veg Combo;”
mail.Subject = “Pizza Order”;
mail.Display(false);
}

WPF - add userid as prefix to orignal mail while forwarding mail

I have textbox which shows the content of mail body.
While forwarding mail original mail body if content is edited by pressing any key then user id should get appended. Please let me know how should I do this in WPF.
Before sending the mail
if(edits_made) // bool value which indicates if changes have been made
{
yourtextbox.Text.Insert(0, userid);
}
Not before sending an mail.
Similar functionality is there in outlook as well.
Add < prefix to original mail if content is modified.
Same I am trying to build in WPF.

Implementing a mailing list in .NET

I am implementing a mailing list using using .NET. As discussed in this answer, I need to send an email where the recipient of the envelope is different from the recipient in the To header. How to achieve this in C#? The SmtpClient and MailMessage classes in System.Net.Mail doens't seem to permit this.
I tried:
message.To.Add("list#example.com");
message.Headers["Envelope-to"] = "user#example.com";
but the mail doesn't get sent to what it is specified in the Envelope-to.
Any suggestions?
Adding an address to Envelope-To without adding it to To
You can use the MailMessage.Bcc property. Addresses added there will only appear in the Envelope-To, not in the mail's To:
message.Bcc.Add("user#example.com");
Adding an address to To without adding it to Envelope-To
Here, I'm quite sure you are out of luck. I've had a look at the System.Net.Mail namespace with ILSpy, and it looks like this is not possible. The To header of the mail is created out of the To property of the MailMessage (see Message.PrepareHeaders), and the same property is used to fill the Envelope-To of the mail (together with the Cc and Bcc properties, see SmtpClient.Send). Manually setting Headers["To"] won't help, since this value is overwritten with the contents of the To property (see Message.PrepareHeaders).
So, list#example.com will get a copy of the message. Depending on the configuration of your SMTP server, this might lead to a mail loop.

How can I send emails to multiple recipients using a MailDefinition

I'm creating a new mail definition using the CreateMailMessage function of a MailDefinition. One of the required parameters is recipients. The documentation for this function states that recipients is to be a comma-separated list of recipients, however when I try to send a message to multiple users I am getting the following error:
An invalid character was found in the mail header: ','...
So it seems like this function is not working as intended. Normally I would add all the recipients to the mail message itself, but unfortunately the recipients parameter is required and cannot be left blank. Any ideas?
I got it working but unfortunately its more of a hack than anything.
I take one email address from the "to" field and set it as the recipient in CreateMailMessage, which returns a MailMessage instance.
I take the produced MailMessage and add all the email addresses in my MailAddressCollection by iterating through the construct. I also do this for all CC'd users.

How to forward an email with the original headers?

I am writing a program that polls an incoming mailbox (to which anyone who knows about it can post), reformats the info, then forwards the mail on to the correct address according to a predefined convention. For example, the incoming mail has:
From = "anybody#somedomain.com"
To = "myincomingmailbox#mydomain.com"
Subject = "Subject"
Body = "recipient#anotherdomain.com+newline+Body"
Then I take that email, preserve the "From" and "Subject" fields, but I change the "To" address to recipient#anotherdomain.com, and format the rest of the body according to my template.
Thus far all OK - but I anticipate a problem with spam filters on the recipient domains, since they may react as if I'm spoofing the "From" address.
What is the correct way to preserve the headers from the original mail intact, such that all the SPF/DKIM headers remain on the outgoing email, and the recipient domains don't treat the incoming mail as possible spam/phishing mails?

Categories

Resources