DAViCal Free/busy information for email aliases - caldav

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?

Related

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());

Outlook FROM field does NOT match Contacts Address Book

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"

retrieve a single email from imap by message_id

I am using ruby's Net::IMAP object and I can retrieve a set of emails using either:
IMAP.all ..args..
Or
IMAP.find ..args..
But is there anyway of retrieving a specific email, preferably by the message-id header for example?
Is this possible or am I limited to all and find and trying to narrow the result set with better arguments?
I didn't understand what technology you're using with IMAP. However the IMAP Specification provides the ability to search by a variety of fields, including email headers. You can use the following IMAP command to retrieve the UID of an email with Message-Id <53513DD7.8090606#imap.local>:
0005 UID SEARCH HEADER Message-ID <53513DD7.8090606#imap.local>
This will then give you a response such as the following:
* SEARCH 1
0005 OK UID completed
In my case the email with Message-Id <53513DD7.8090606#imap.local> was the first one, so the SEARCH command returned a matching UID of 1.
You can then retrieve the message using a UID FETCH command, such as the following:
0006 UID FETCH 1 BODY[]
Naturally, if you know the UID in advance, you can skip the UID SEARCH step, but that depends on your application.
For anybody else who is looking at this, these keys will do the trick:
keys: ['HEADER', 'MESSAGE-ID', message_id]
Just to give a full ruby solution incase it's helpful to someone else.
Bear in mind that if the message is in a subfolder you'll need to manually search through each folder to find the message you are after.
search_message_id = "<message-id-you-want-to-search-for>"
email = "youremail-or-imap-login"
password = "yourpassword"
imap = Net::IMAP.new("imap.example.com", 993, ssl: true)
imap.login(email, password)
imap.select("Inbox")
imap.search(["HEADER", "Message-ID", search_message_id]).each do |message_id|
envelope = imap.fetch(message_id, "ENVELOPE")[0].attr["ENVELOPE"]
puts "Id:\t#{envelope.message_id}"
puts "From:\t#{envelope.from[0].mailbox}##{envelope.from[0].host}"
puts "To:\t#{envelope.to[0].mailbox}##{envelope.to[0].host}"
puts "Subject:\t#{envelope.subject}"
end
imap.logout
imap.disconnect
You can change the above to search all sub-folders by doing:
folders = imap.list("", "*")
folders.each do |folder|
imap.select(folder.name)
imap.search # ...
end

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.

check if email are valid and exists

I am working on a web app that requires me to check if the users email are valid and exists. (I do the regex check) The question is what is best practice of verifying that an email exists?
Here are some options that I have though about:
send an email to the user and make them confirm the email address
do a VRFY SMTP - is this still used? should i bother looking into it?
any other good idea?
sending a verification email to the user verifies that the email is valid and that the user is the owner of the account
Doing a regex check on an email address can be frustrating for some users, depending upon the regex. In my case, I have several domains where all of the addresses are delivered to a single mailbox, so I can use the address to specify the sender (for filtering). Here are some valid (per RFC 2822) address patterns that I have had rejected by various websites:
foo#example.name
foo#example.info
foo+sitename#example.org
foo-sitename#example.com
I recommend that you skip your regex test and just send the verification email with a confirmation link -- anything else will leave your application brittle and subject to breakage as soon as someone comes up with a new DNS or SMTP extension.
PS: ICANN is expected to approve UNICODE domain names Real Soon Now. That will play merry hell with Regex patterns for email addresses.
Not an answer to your question, but I'd like to quote someone on reddit:
Validating an email address using nothing but a regular expression is like building a house using nothing but a power drill.
This is the only RFC-valid way to do it:
[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\ xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xf f\n\015()]*)*\)[\040\t]*)*(?:(?:[^(\040)<>#,;:".\\\[\]\000-\037\x80-\x ff]+(?![^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff])|"[^\\\x80-\xff\n\015 "]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[\040\t]*(?:\([^\\\x80-\ xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80 -\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]* )*(?:\.[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\ \\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\ x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>#,;:".\\\[\]\000-\037\x8 0-\xff]+(?![^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff])|"[^\\\x80-\xff\n \015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[\040\t]*(?:\([^\\\x 80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^ \x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040 \t]*)*)*#[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([ ^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\ \\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>#,;:".\\\[\]\000-\037\ x80-\xff]+(?![^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80- \xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015() ]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\ x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\04 0\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\ n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\ 015()]*)*\)[\040\t]*)*(?:[^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff]+(?! [^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\ ]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\ x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\01 5()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)*|(?:[^(\040)<>#,;:". \\\[\]\000-\037\x80-\xff]+(?![^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff] )|"[^\\\x80-\xff\n\015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[^ ()<>#,;:".\\\[\]\x80-\xff\000-\010\012-\037]*(?:(?:\([^\\\x80-\xff\n\0 15()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][ ^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)|"[^\\\x80-\xff\ n\015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[^()<>#,;:".\\\[\]\ x80-\xff\000-\010\012-\037]*)*<[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(? :(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80- \xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:#[\040\t]* (?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015 ()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015() ]*)*\)[\040\t]*)*(?:[^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\0 40)<>#,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\ [^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\ xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]* )*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80 -\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x 80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t ]*)*(?:[^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>#,;:".\\ \[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff]) *\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x 80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80 -\xff\n\015()]*)*\)[\040\t]*)*)*(?:,[\040\t]*(?:\([^\\\x80-\xff\n\015( )]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\ \x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*#[\040\t ]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\0 15()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015 ()]*)*\)[\040\t]*)*(?:[^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff]+(?![^( \040)<>#,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]| \\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80 -\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015() ]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x 80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^ \x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040 \t]*)*(?:[^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>#,;:". \\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff ])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\ \x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x 80-\xff\n\015()]*)*\)[\040\t]*)*)*)*:[\040\t]*(?:\([^\\\x80-\xff\n\015 ()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\ \\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)?(?:[^ (\040)<>#,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>#,;:".\\\[\]\000- \037\x80-\xff])|"[^\\\x80-\xff\n\015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\ n\015"]*)*")[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]| \([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\)) [^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80-\xff \n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\x ff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*( ?:[^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>#,;:".\\\[\]\ 000-\037\x80-\xff])|"[^\\\x80-\xff\n\015"]*(?:\\[^\x80-\xff][^\\\x80-\ xff\n\015"]*)*")[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\x ff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*) *\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)*#[\040\t]*(?:\([^\\\x80-\x ff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80- \xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*) *(?:[^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>#,;:".\\\[\ ]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\] )[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80- \xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\x ff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80-\xff\n\015()]*( ?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80 -\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)< >#,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>#,;:".\\\[\]\000-\037\x8 0-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?: \([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()] *(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*) *\)[\040\t]*)*)*>)
So let's not.
Sending them an e-mail forcing them to press a confirmation link is the best option, as there's always the chance that their SPAM filter will block your mails. It's best to get that dealt with when their paying attention.
In Perl there is a nice module called Email::Valid which can check the email address for valid formation, and optionally check the email address's domain for an MX record.
function EmailValidation($email)
{
$email = htmlspecialchars(stripslashes(strip_tags($email))); //parse unnecessary characters to prevent exploits
if ( eregi ( '[a-z||0-9]#[a-z||0-9].[a-z]', $email ) )
{ //checks to make sure the email address is in a valid format
$domain = explode( "#", $email ); //get the domain name
if ( #fsockopen ($domain[1],80,$errno,$errstr,3))
{
//if the connection can be established, the email address is probably valid
return true;
} else
{
return false; //if a connection cannot be established return false
}
return false; //if email address is an invalid format return false
}
}