Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component


Index of Chilkat Blog Posts

December 28, 2007

Replace Sender Header Field?

Question:
After I load an email (a eml file) by using CkMailMan, how I am going to replace the "Sender" header field value?

CkMailMan mailman;
mailman.UnlockComponent("Anything for 30-day trial");
CkEmail* pemail=NULL;
pemail=mailman.LoadEml((LPCTSTR) emlfile);
//I could not find a sender field property or method in CkEmail.

Answer:
Normallly, when you create a new email and send it, there is no "Sender" header. The sender is specified in the "From" header field. The From property handles this header field.

However, assuming you downloaded an email from a POP3 or IMAP server containing a "Sender" header field and you want to modify it, you can do so by calling AddHeaderField.
The AddHeaderField will add a new header field, or replace the header field if it already exists:

CkMailMan mailman;
mailman.UnlockComponent("Anything for 30-day trial");
CkEmail* pemail=NULL;
pemail=mailman.LoadEml((LPCTSTR) emlfile);
<strong>pemail->AddHeaderField("Sender","admin@chilkatsoft.com");</strong>


Privacy Statement. Copyright 2000-2011 Chilkat Software, Inc. All rights reserved.
Send feedback to support@chilkatsoft.com

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, Windows 7, and Windows 95/98/NT4.