When you go to Contacts >> More >> vCard format >> Export – this will create a contact file.
If you then compose a new message, attach that .vcf file, send to a Gmail address – Gmail will display a nice “Import to contacts” shortcut link to the recipient.

When you re-create the .vcf file in GAS in the same format as the exported file and send it as an attachment with GmailApp, Gmail does not show the “Import to contacts”. It just shows “View”.

However, if you click Download on the file created with GAS then attach and send in a new message composed manually, Gmail will show the Import link.
Is there anything Apps Script can do to ensure the “Import to contacts” link shows up when using GmailApp to send a vCard file as an attachment or is this really more of a Gmail issue?
var layout = 'BEGIN:VCARD' + '\n' +
'VERSION:3.0' + '\n' +
'FN: Forrest Gump' + '\n' +
'N:Gump;Forrest;;;' + '\n' +
'EMAIL;TYPE=INTERNET:forrestgump@example.com' + '\n' +
'END:VCARD' + '\n';
var vCard = [{fileName:"new contacts.vcf", content:layout}];
GmailApp.sendEmail("example@gmail.com", "Subject", "Body...", {attachments: vCard});
It’s because you sent it as plain text. If you want Gmail to recognize it as vCard. You need to send it as octet-stream.
To fix this just put
mimeType:"application/octet-stream"to your attach file descriptione.g.