(fix) EAS fix on qp-encoded subjects (#3390)
parent
5f54ee09f1
commit
faa5d83cf6
|
@ -2573,7 +2573,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
NSString *fullName, *email;
|
||||
|
||||
const char *bytes;
|
||||
int i, len;
|
||||
int i, e, len;
|
||||
BOOL found_header;
|
||||
|
||||
// We get the mail's data
|
||||
|
@ -2622,6 +2622,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
{
|
||||
found_header = YES;
|
||||
i = i + 2; // \r\n
|
||||
bytes = bytes + 2;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2629,12 +2630,26 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
i++;
|
||||
}
|
||||
|
||||
// We search for the first \r\n AFTER the From: header to get the length of the string to replace.
|
||||
e = i;
|
||||
while (e < len)
|
||||
{
|
||||
if ((*bytes == '\r') && (*(bytes+1) == '\n'))
|
||||
{
|
||||
e = e + 2;
|
||||
break;
|
||||
}
|
||||
|
||||
bytes++;
|
||||
e++;
|
||||
}
|
||||
|
||||
// Update/Add the From header in the MIMEBody of the SendMail request.
|
||||
// Any other way to modify the mail body would break s/mime emails.
|
||||
if (found_header)
|
||||
{
|
||||
// Change the From header
|
||||
[data replaceBytesInRange: NSMakeRange(i, [[message headerForKey: @"from"] length]+8) // start of the From header found - length of the parsed from-header-value + 8 (From:+\r\n+1)
|
||||
[data replaceBytesInRange: NSMakeRange(i, (NSUInteger)(e-i))
|
||||
withBytes: [new_from_header bytes]
|
||||
length: [new_from_header length]];
|
||||
}
|
||||
|
@ -3160,7 +3175,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
nil]];
|
||||
|
||||
#endif
|
||||
s = [NSString stringWithFormat: @"Date: %@\n%@", value, [theRequest contentAsString]];
|
||||
s = [NSString stringWithFormat: @"Date: %@\r\n%@", value, [theRequest contentAsString]];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue