Skip to content

Commit

Permalink
Merge pull request Alinto#62 from the-nic/fix-5654
Browse files Browse the repository at this point in the history
fix(smtp): Format ipv6 correctly for SMTP EHLO
  • Loading branch information
WoodySlum authored Dec 8, 2022
2 parents bd7d986 + 5f9cb49 commit 41a0fc7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sope-mime/NGMail/NGSmtpClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -511,14 +511,21 @@ - (void)_fetchExtensionInfo {
NGSmtpResponse *reply = nil;
NSString *hostName = nil;
NGActiveSocket* sock;
NGInternetSocketAddress* sockAddr;

if (previous_socket) {
sock = self->previous_socket;
} else {
sock = self->socket;
}

hostName = [(NGInternetSocketAddress *)[sock localAddress] hostName];
sockAddr = (NGInternetSocketAddress *)[sock localAddress];
if ([sockAddr isIPv6] && [[sockAddr hostName] isEqualToString: [sockAddr address]]) {
hostName = [NSString stringWithFormat:@"[IPv6:%@]", [sockAddr address]];
}
else {
hostName = [sockAddr hostName];
}

reply = [self sendCommand:@"EHLO" argument:hostName];
if ([reply code] == NGSmtpActionCompleted) {
Expand Down

0 comments on commit 41a0fc7

Please sign in to comment.