Gmail - Import to contacts link - gmail

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 description
e.g.
var vCard = [{fileName:"new contacts.vcf", content:layout, mimeType:"application/octet-stream"}];

Related

Button in Lotus Notes that automatically forwards en email with attachment

I'm trying to make a button in IBM Notes that automatically forwards emails with attachments to a specific address.
I have looked at 2 previous examples on this website but none of them are working for me and I get the mail forwarded to myself.
Can anyone help?
The 2 codes I've tried are:
_From := #Text(From);
#Command([MailForward]);
#Command([EditNextField]);
#Command([EditInsertText]; _From);
#Command([EditGotoField]; "Body");
#Command([EditInsertText]; "Your text" + #NewLine + "goes here...")
and
FIELD SendTo:= "person#mail.com" ;
#Command( [MailForwardAsAttachment] )
The IBM Notes version I'm using is # 9.
Thank you
Use the first example and change it to:
#Command([MailForward]);
#Command([EditInsertText]; "person#mail.com");
#Command([EditGotoField]; "Body");
#Command([EditInsertText]; "Your text" + #NewLine + "goes here...")
Replace the email address in second code line with your specific address and adapt the remaining lines too.

Send Emails using Python Win32. Adding Image to the Body of the Email is not working

I am trying to add an Image to an Email Body.
I am using Outlook 16 and Python 3.7 to do this.
The mail gets sent from Mailbox.
Here is my code function to send email and how can I add an Image at the end of the email.
def send_email(sender,recipient):
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = recipient
mail.Subject = Subject_Req
mail.HTMLBody = Content_Email
mail.SentOnBehalfOfName = sender
mail.GetInspector
mail.Send()
The Image is present in my local network :- C:\Users\Sid\AppData\Roaming\Microsoft\Signatures\My Project\image001.png
The Image is nothing but the logo which I want to put at the last part of the HTML body.
So basically from the function it will be Content_Email + This image.
I tried some code, what it does is :- it sends an "X" mark at the end in place of the image itself to the recipient.
And when I send it to myself, It puts the "X" mark but I get an option to download pictures on right click and it gets the Image.
What I would like to do is, put the Image instead of the "X" for both the cases without the user having to have access to that Image.
How can I do this using Python. The solution in here seems to be working with VBA : https://www.experts-exchange.com/questions/26481413/Problem-inserting-HTML-images-into-the-body-of-a-messge.html
I managed to get this to work through attachment.PropertyAccessor.SetProperty function.
def send_email(sender,recipient):
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = recipient
mail.Subject = Subject_Req
attachment = mail.Attachments.Add(signatureimage)
attachment.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001F", "MyId1")
mail.HTMLBody = Content_Email + "<html><body><img src=""cid:MyId1""></body></html>"
mail.SentOnBehalfOfName = sender
mail.GetInspector
mail.Send()
#Change the Paths here, if ran from a different location
signatureimage = "C:\\Users\\Sid\\AppData\\Roaming\\Microsoft\\Signatures\\My Project\\image001.png"
This would mean, it will embed the Image and not link the Picture to a link. Linking to a picture expects the recipients to have access to that particular picture location.
Also, for a learning this link doesn't change at all :- http://schemas.microsoft.com/mapi/proptag/0x3712001F

Send details to email on click of a button

I am developing an android app and i have a few edit texts and a submit button.
On click of the submit button all the fields in the edit texts entered by the user should be sent to a particular email id.
Could anyone please suggest me how it can be done?
String s = editText.getText().toString();
in button's onClickListner() method use this
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + email));
emailIntent.setType("text/plain");
emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(Intent.EXTRA_TEXT, s);
//emailIntent.putExtra(Intent.EXTRA_HTML_TEXT, body); //If you are using HTML in your body text
startActivity(Intent.createChooser(emailIntent, "Send Email via"));
Already answered Here
As you are working with multiple editTexts you can do this,
String s = (editText1.getText().toString() + "\n" + editText2.getText().toString() + "\n"+editText3.getText().toString() + "\n" + editText4.getText().toString() + "\n" + editText5.getText().toString() + "\n" + editText6.getText().toString() + "\n");
and then use same snippet as above.
If you want to know how send email without prior user interaction then see this answer
see this code snippet here also : https://github.com/enrichman/androidmail
There is also an API available named mandrillapp:
Read this blog for full code : https://www.mindstick.com/Articles/1673/sending-mail-without-user-interaction-in-android

How to use matlab to send email through Outlook and with some excel tables shown in the body of email

I want to use matlab to automatically send the email (through outlook) to others while I want the table is to be shown in the body of email, not as the attachment.
Suppose i have a spreadsheet named ABC.xlsx, if I want to extract one sheet and put it in the body of email, what should I do?
I use the following code,
h = actxserver('outlook.Application');
mail = h.CreateItem('olMail');
mail.Subject = 'test';
mail.To = ['***#****.com'];
mail.BodyFormat = 'olFormatHTML';
mail.HTMLBody = 'This is a test for email sending!';
mail.attachments.Add('ABC.xlsx');
mail.Send;
h.release;
I recommend you take a look at function xlsread, documented here. After reading the desired contents of the xlsx page, you can format them as an html table and put it in mail.HTMLBody.

phpmailer PDF attachments suddenly sent as text attachments

We have a cript that mails us attachments in PDF format.
Worked for years and suddenly stopped working.
PDF's now are created and mailed, but not mailed as PDF, but as textfiles instead, with .txt extension.
$mail_handler = new PHPMailer(); // defaults to using php "mail()"
//$mail_handler->Body = $contents_mail_handler;
$mail_handler->Body = $contents_mail_handler;
$mail_handler->From = MAIL_SENDER;
$mail_handler->FromName = MAIL_SENDER;
$mail_handler->Subject = "#$inserted_order_id: $name - € $total";
$mail_handler->AddAddress($email_handler, $email_handler);
$file_nl = "_orders/" . $filename_nl;
$mail_handler->AddAttachment($file_nl,$filename_nl); // attachment
$file_en = "_orders/" . $filename_en;
$mail_handler->AddAttachment($file_en,$filename_en); // attachment
$file_fr = "_orders/" . $filename_fr;
$mail_handler->AddAttachment($file_fr,$filename_fr); // attachment
$mail_handler->Send();
$mail_handler->ClearAddresses();
$mail_handler->ClearAttachments();
text attachment content example : http://pastebin.com/tdfKfQCq
Any help is highly appreciated, thanks!
Bas
Thanks. Path was ok. Updated phpmailer, fixed the problem.

Resources