From 426ea685ae35c70a7a5343a9bab28c573d94492e Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Fri, 10 Jan 2014 00:49:12 +0100 Subject: [PATCH] Generate lowercase "cid:" for Apple Mail. Case-insensitive comparison for "cid:" prefix. --- src/vmime/htmlTextPart.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/vmime/htmlTextPart.cpp b/src/vmime/htmlTextPart.cpp index 44459336..cd7d6204 100644 --- a/src/vmime/htmlTextPart.cpp +++ b/src/vmime/htmlTextPart.cpp @@ -108,8 +108,14 @@ void htmlTextPart::generateIn(shared_ptr /* message */, shared_ptr getId(); - if (id.substr(0, 4) == "CID:") + if (id.length() >= 4 && + (id[0] == 'c' || id[0] == 'C') && + (id[1] == 'i' || id[1] == 'I') && + (id[2] == 'd' || id[2] == 'D') && + id[3] == ':') + { id = id.substr(4); + } objPart->getHeader()->ContentType()->setValue((*it)->getType()); objPart->getHeader()->ContentId()->setValue(messageId("<" + id + ">")); @@ -462,7 +468,7 @@ const string htmlTextPart::embeddedObject::getId() const const string htmlTextPart::embeddedObject::getReferenceId() const { if (m_refType == REFERENCED_BY_ID) - return string("CID:") + m_id; + return string("cid:") + m_id; else return m_id; }