Outlook FROM field does NOT match Contacts Address Book - email

Platform: Outlook 2013 as my email client.
Problem: I have contacts stored in Contacts Address Book, not the GAL;
When an email is received from someone, what I see in the FROM field is not equivalent to what is located in MY Contacts Address Book in Outlook.
I see, what I assume, is the way the user set up their account in their respective email service providers.
As an example, I have "Good Friend ", but when I receive an email from this person, it displays, e.g. "John Smith ".
How can I get Outlook "know" to display what my contacts' info in MY contacts address?

You can read the sender email address (MailItem.SenderEmailAddress), open the Contacts folder (Namespace.GetDefaultFolder(olFolerContacts)), search for a matching contact using MAPIFolder.Items.Find with a query like "([Email1Address] = 'user#domain.demo') or ([Emai21Address] = 'user#domain.demo') or ([Email3Address] = 'user#domain.demo')" .
Once you have ContactItem object, read its FileAs property and set the PR_SENDER_NAME and PR_SENT_REPRESENTING_NAME properties on the original message using MailItem.PropertyAccessor.SetProperty. The DASL names of the properties are
"http://schemas.microsoft.com/mapi/proptag/0x0C1A001F"
and
"http://schemas.microsoft.com/mapi/proptag/0x0042001F"

Related

DAViCal Free/busy information for email aliases

I have system users with short usernames but they all have email aliases
<first-name>.<last-name>#example.com .
Davical locates the calendar and free/busy information by email address, that is the
<username>#example.com .
How do I configure DAViCal so people can book meetings with the long email-adress?

If/Else Loop and Auto Email

New to coding and trying to jump right in!
I have a new list of customers I'm responsible for in a spreadsheet, and I receive an email from someone I don't immediately recognize.
I need to set up a script to:
1. determine if they are in my book of business
2. if they are in my book of business, send a template email regarding next steps (email A)
3. if they are not in my book of business, send a template email that i'm not their POC and redirecting them to relevant resources (email B)
I believe I need to set up a loop (if/else?) to see if the email I received is from a sender on the list, if it is, send email a, if it isn't send email b.
Does anyone have feedback on my stab below? I've set up a dumbie example I will constantly be working on and updating. https://docs.google.com/spreadsheets/d/1HcLluPhRgl0ihQT0GA-ZFj1KsOPHxl0dU08EFlh2Gss/edit#gid=0
For the if/else I believe I would start with
if (CustomerName) {exists Send email A
} else {Send Email B
}
// The code below will send an email with the current date and time.
var now = new Date();
GmailApp.sendEmail("jlennon#gmail.com", "current time", "The time is: " + now.toString());

Is there a reliable way to determine a person's SMS address given their phone number and email address?

Since programatically sending a text with Meteor from the user's own cell phone number seems to be problematic (see this), I'm thinking the way to do this could be to send the SMS / texts as an email.
I often do this manually from work when I text my wife from an email client; the "rub" is that the format for the addresses to use differ based on carrier. e.g., when I SMS my wife via email, I use and address like the following:
0871632810#txt.att.net
That obviously works for someone using att.net as their carrier. For other carriers, other naming schemes are used (which can be found here and here.
So my idea is, if I know the user's phone number and their email address, I can cobble together the correct SMS address to use as the "from" in an email. e.g., given the following:
Phone == 0871632810
Email == guinevere#att.net
...I could have a function like (pseudocode):
string getSMSAsEmailAddr(phone, email) {
var emailAsSMS;
if (email.contains('att.net') {
emailAsSMS = 'txt.att.net';
}
else if (email.contains('comcast.net') {
emailAsSMS = 'comcastpcs.textmsg';
}
. . .
return phone + '#' + emailAsSMS;
}
The problem is, can a person's carrier/valid SMS address always be determined by their email address? I'm thinking no - for example, what if a person has comcast but their email address is gmail, or something else altogether?
Is it necessary, in order to reliably build the needed SMS address, to know the user's carrier (both sender and receiver) and leave the email address out of the equation?
UPDATE
There is at least one for-pay service for returning carriers for a phone number, such as this API. There is also one called "CallFire" but both of these cost moolah ($$). I prefer a free option (yes, I'm a cheapskate).
I'm thinking the way to do this is something like:
var phoneNum = $('#phoneNumber').val(); // returns something like '0871632810'
var carrier = getCarrierForPhoneNumber(phoneNum);// returns something like 'att' or 'comcast' or whatever
var textAddrSuffix = getTextAddrSuffixForCarrierName(carrier); // returns (if carrier is 'att', as an example) something like '#txt.att.net'
var textAddrViaEmail = phoneNum + textAddrSuffix; // returns something like '0871632810#txt.att.net'
textAddrViaEmail can now be used as either the "to" or "from" email address.
No, but there is a library with a rather large database of them over at https://github.com/typpo/textbelt.

Get sender email address in Infopath

I have a form sent by email that travels through different persons like this.
Person A --> Person B --> Person C
I want the person A to be informed when the form is treated by person C. So Person A needs to be in copy of the email sent by person B.
Because person A isn't always the same one, I think the best way to put him/her in copy is to use the "from" field of the email received by person B and to put it in copy.
But how can I find this address with infopath and how can I place it into my email data connection ?
I had this same question today myself and could not find much in the way of answers.
So... I did some work myself and came up with a few solutions.
First I don't believe there is any way to get/set the "From" address using the InfoPath OM. This means you will have to use one of the following options:
No Code:
You will be limited to providing a field on the form where "Person A" can put their email address and use this in the CC. for subsequent stages. That's kind of the only way and while it an extra burden to the user it does have the benefit of providing flexibility.
Code:
Write your own code to send the mail using Outlook Interop or System.Net.Mail and then you will be setting all of the addresses manually anyway.
If you are using AD or something else then you could always get the email address of the current use using System.DirectoryServices.AccountManagement.
Based on an assumption which I cannot find any documentation to back up. That InfoPath uses the account associated with the default store to send email using EmailSubmitConnection. You should be able to use Outlook Interop to find the address that InfoPath will use.
Here is a code sample:
using Outlook = Microsoft.Office.Interop.Outlook;
public string GetDefaultSenderAddress()
{
// This actually opens outlook in the same way as InfoPath does to send the message.
// which can be slow.
string DefaultAddress = string.Empty;
Outlook.Application OutlookApplication = new Outlook.Application();
string DefaultStoreId = OutlookApplication.Session.DefaultStore.StoreID;
foreach (Outlook.Account Account in OutlookApplication.Session.Accounts)
{
if (Account.DeliveryStore.StoreID == DefaultStoreId)
{
DefaultAddress = Account.SmtpAddress;
}
}
// Note you probably won't want to quit if you are about to send the email.
// However I have noticed that this doesn't seem to close Outlook anyway.
OutlookApplication.Quit();
return DefaultAddress;
}
You may have to provide a few more checks in case of different account types etc. But I believe it will work. (I tested it for my scenario and it does).
Note: Of course this opens an outlook instance which you will have to close as well. And it can be slow. Unless outlook is already open in which case it will be very quick. Anyhow when sending from InfoPath Outlook will have to be opened so if you do this just before sending then there should be no noticeable difference.
I would advise using a combination of the no code/with code options so provide a return address which is automatically complete to save the user time. But can be corrected if the user wishes to have the email returned to a different address of if there is a mistake.
Hope that you find that useful.

How would you model an Email app in MongoDB?

How would you model an email app (like gmail) in MongoDB? Would you model a Conversation? Inbox / OutBox? or mail?
Thanks
Gmail use concept of labels (like tags on stackoverflow). That mean that inbox, send mail, starred, etc normal Email object, just marked with specified label. So, there are only Email and Labels.
You can see it using search in gmail like label:inbox or label:Starred.
I'd like to suggest a fairly simple design like this:
Email
{
_id
Title,
Body,
Status {read, unread},
Labels { name, type(system, custom) },
Replies {...},
..
}
Labels
{
_id,
name,
settings {
ShowInLabelsList (show, hide, showIfUnread),
ShowInMessageList (show, hide),
..
}
}
For sure i've missed something, but i guess it's okay to start from above schema and add more features in future if neeed.
Update:
For the 'Conversation View' i guess all replies show go to the nested collection Replies (i've update my schema). Logic is following:
Once you have received a new message you need check if email with same name already exists (for sure need to Remove 'Re', etc..) also need to check that user that has sent email in list of recipients. If above conditions is true then just add new email to nested collection of Replies otherwise add to collection of emails.