Office365 API append email signatures based on senders email address - office365api

We are considering using Office365 API to send our emails. One reason we are considering Office365 is to be able to automatically apply signatures. So if we send automated email for a specific user, are we able to specify that we want the signature appended to that email?
Would we be required to use the user credentials for the user we are sending with, or are there Admin roles available allowing use to pick / automatically apply the correct email signature?
Thanks,

AFAIK, you can't choose/apply different signature when sending email to specific user with O365 API. As a workaround, with outlook mail rest api ,you could create an email message , inserts an email signature into the end of email message body when sending to a specific user. You could use a HTML body for your email message,for example :
// Create the email message text body.
string htmlBodyTxt = #"<html><head></head><body><p>This is the email message body before a signature is added.</p>
</body></html>";
// Identify the signature insertion point at the end of the HTML body.
int signatureInsertPnt = htmlBodyTxt.IndexOf("</body>");
// Create the email signature.
string signature = "<p>Dallas Durkin<br/>Senior Planner<br/>Adventure Works Cycles</p>" +
"<p>4567 Main St.<br/>La Habra Heights, CA 90631</p><p>(323) 555-0100</p>";
// Insert the signature into the HTML body.
string newBody = htmlBodyTxt.Insert(signatureInsertPnt, signature);

Related

Getting the wrong attachment id from office.js for self emailed attachments

I have an outlook add-in that is getting a attachmentId and messageId from office.js and from there I use the translate api to translate the ewsId to a restId and then use graph api to fetch the attachment details. This works fine regularly, but when I email an attachment to myself or forward an attachment to myself, the attachmentId I get from office.js cannot be used to find the attachment on graph api.
If instead I use ews then there is not issue.
call to graph api:
https://graph.microsoft.com/v1.0/me/messages/{{messageId}}/attachments/{{attachmentId}}
Email "A" from another user
messageId:
"AAMkADQ2NDE4MTgwLTc3YWYtNDMyNy1hNzBlLWYwYjFhNDFmOGMyMQBGAAAAAADe8oquh3hHQ4w-IhUlYfScBwBAr1kmfoJuRo_-wLGwaLC2AAAAAAEMAABAr1kmfoJuRo_-wLGwaLC2AAAnJNB1AAA="
attachmentId:
"AAMkADQ2NDE4MTgwLTc3YWYtNDMyNy1hNzBlLWYwYjFhNDFmOGMyMQBGAAAAAADe8oquh3hHQ4w-IhUlYfScBwBAr1kmfoJuRo_-wLGwaLC2AAAAAAEMAABAr1kmfoJuRo_-wLGwaLC2AAAnJNB1AAABEgAQADY8gKUKKedKsb_bhRYobps="
If I email, email "A" to myself:
messageId:
"AAMkADQ2NDE4MTgwLTc3YWYtNDMyNy1hNzBlLWYwYjFhNDFmOGMyMQBGAAAAAADe8oquh3hHQ4w-IhUlYfScBwBAr1kmfoJuRo_-wLGwaLC2AAAAAAEJAABAr1kmfoJuRo_-wLGwaLC2AABW6oApAAA="
attachmentId:
"AAMkADQ2NDE4MTgwLTc3YWYtNDMyNy1hNzBlLWYwYjFhNDFmOGMyMQBGAAAAAADe8oquh3hHQ4w-IhUlYfScBwBAr1kmfoJuRo_-wLGwaLC2AAAAAAEMAABAr1km

Docusign iOS SDK directly sending envelope without opening anything also not asking to do the signature

I have created a template in docusign web and using its template id, i am calling the function from iOS SDK.
TemplatesManager.sharedInstance.displayTemplateForSignature(templateId: templateId, controller: self, tabData: tabData, recipientData: recipientData, customFields:customFields, onlineSign: onlineSign, attachmentUrl: attachmentUrl) { (controller, errMsg) in
print(errMsg)
}
The recipient data i am sending is
let recipientDatum = DSMRecipientDefault()
// Use recipient roleName (other option to use recipient-id) to find unique recipient in the template
recipientDatum.recipientRoleName = "Client"
recipientDatum.recipientSelectorType = .recipientRoleName
recipientDatum.recipientType = .inPersonSigner
// In-person-signer name
recipientDatum.inPersonSignerName = "Akshay Somkuwar"
// Host name (must match the name on the account) and email
recipientDatum.recipientName = "Akshay Somkuwar"
recipientDatum.recipientEmail = "akshay.s.somkuwar#gmail.com"
let recipientData: Array = [recipientDatum]
Same recipient is added for template in docusign website
Also i have added observers for DSMSigningCompleted and DSMSigningCancelled to get envelopeId.
Now when i am calling this function displayTemplateForSignature no screen is opening to show the PDF or To sign the PDF, without asking for signature, the envelope is directly sent to the recipient. and i am getting this response in console with notification.
name = DSMSigningCompletedNotification, object = Optional(<Public_Adjuster.AgreementSignViewController: 0x110bb8060>), userInfo = Optional([AnyHashable("templateId"): 506346f5-7adb-4132-b15f-d288aa268398, AnyHashable("signingMode"): online, AnyHashable("envelopeId"): 2eeeeda8-5b74-4930-904e-94b2ce6451ac])
I want to open the pdf for the passed templateId but its not opening the pdf nor its asking for signature, and its directly sent to the recipient.
Any help will be appreciated, Thank you.
This behaviour, sending the envelope directly, is triggered when DocuSign SDK can not find any signers in the template/envelope that matches the logged-in user. Given that you are using the recipientDefaults, ensure that your signer information on the template (preset signer on the DocuSign web) matches the Account information exactly with the recipientDefaults object.
You may compare it with .
One issue I noticed is the signer type is set to need to sign which corresponds to a remoteSigner on the DocuSign web. And on the recipientDefaults object it's set as inPersonSigner. It should be .signer corresponding to DSMRecipientTypeSigner.
recipientDatum.recipientType = .signer.
Or you may change the need to sign to in person signer on the DocuSign web.
Another suggestion is to remove the name & email from the template screenshot shared and keep that empty as the client app is passing name & email with the recipientDefaults object to the SDK.
More details: How to set recipient defaults

How can I send HTML tag string in REST API by using Swift Alamofire?

I need to send HTML string to server.
I am using Swift alamofire and when I try to call Rest api then getting ccs code response from server.
same body format used in PostMan and it's working good.
My request body parameters:
{body = "<br/><br/>Hi Bhavdip,<br/><br/>Please find the One-Time Password (OTP) as requested through application.<br/>OTP- 123456 <br/><br/>Kindly, enter this OTP in your mobile application to authenticate your account and change phone number.<br/><br/>Kind regard,<br/>VeriDoc Global Team.";subject = "VeriDoc Global OTP for Account Verification";toaddress = "bambhroliya.bhavdip#example.com"; toname = "Bhavdip Patel";}
Response:
invalid json format. getting css code.
Param Value is
"<br/><br/>Hi Bhavdip,<br/><br/>Please find the One-Time Password (OTP) as requested through application.<br/>OTP- 123456 <br/><br/>Kindly, enter this OTP in your mobile application to authenticate your account and change phone number.<br/><br/>Kind regard,<br/>VeriDoc Global Team."
let params = [body = "<br/><br/>Hi Bhavdip,<br/><br/>Please find the One-Time Password (OTP) as requested through application.<br/>OTP- 798580 <br/><br/>Kindly, enter this OTP in your mobile application to authenticate your account and change phone number.<br/><br/>Kind regard,<br/>VeriDoc Global Team.",subject = "VeriDoc Global OTP for Account Verification",toaddress = "bambhroliya.bhavdip#tristonsoft.com", toname = "Bhavdip Patel"] as! [String:Any]
use this as your params

Send an email from my app without using MFMailComposeViewController

Is it possible to send an automatically generated email using my own email address to another email address of mine by clicking a button?
I tried to use MFMailComposeViewController but another view appeared. Can I do it without this view?
You can do it only by creating own server-side mailer. On button clicking you have to send request with all needed data (email address, body, subject, etc) and server will send mail.
If You want send directly from app - MFMailComposeViewController is the only LEGAL way
By default in iOS you can only use the MFMailComposeViewController, which uses the user's mail account. Therefore you cannot send fully automated mail messages (the user allways has to confirm/cancel).
libMailCore is a great iOS framework which allows you to generate and send mails without any user interferance. In that case you'll be using your own server/credentials (thus not the user mail account). There are apps in the App Store using mailcore, so i would guess it's legit.
Yes there is a way using Swift-SMTP.
Send email
Create a Mail object and use your SMTP handle to send it. To set the sender and receiver of an email, use the User struct:
let drLight = Mail.User(name: "Dr. Light", email: "drlight#gmail.com")
let megaman = Mail.User(name: "Megaman", email: "megaman#gmail.com")
let mail = Mail(
from: drLight,
to: [megaman],
subject: "Humans and robots living together in harmony and equality.",
text: "That was my ultimate wish."
)
smtp.send(mail) { (error) in
if let error = error {
print(error)
}
}

how to share a link via sms in blackberry

I am building an application where I need the option to share via email and SMS.
I have done the share via Email, where when the user selects the image, the url is passed as the content of the email. But while sharing via SMS, I can't do something like setContent as I did for email and fetch the url in the SMS directly, instead of user typing the address manually.
I am using Message class in email and MessageConnection class for SMS, as shown in the blackberry community example.
The Message object you receive when calling MessageConnection.newMessage(TEXT_MESSAGE) is actually a TextMessage object (or a BinaryMessage object with BINARY_MESSAGE).
If you cast the received object to the proper class (TextMessage or BinaryMessage), you should be able to use its setPayloadText(String data) (or setPayloadData(byte[] data) for a BinaryMessage) to enter a value in the message before sending it.
Your code should look like this:
Message msg = myMessageConnection.newMessage(TEXT_MESSAGE, /* address */);
TextMessage txtMsg = (TextMessage)msg;
txtMsg.setPayloadText(/* Text to send */);
myMessageConnection.send(msg);
When you send an email, you can set the body of it and send it to the user from the Email native application. You cant do taht for SMSs. I worked on that issue and for BB Torch I was able to set the text of the SMS message but for other devices that was impossible. I always obtain an empty text message!!
So y suggestion to you is using the following code wich will send the SMS to a number without the interference of the user
MessageConnection conn = (MessageConnection) Connector.open("sms://" + userNumber);
TextMessage txtmessage = (TextMessage) conn.newMessage(MessageConnection.TEXT_MESSAGE);
txtmessage.setPayloadText(text);
conn.send(txtmessage);

Resources