Changing the response options in Outlook with MATLAB actxserver - matlab

Below is a simple example of a MATLAB actxserver for sending Outlook invitations that works without any problems. However, my question is how to turn off the reply options. Required Attendees do not have to reply, whether they are present or not.
out = actxserver('outlook.Application');
appointment = out.CreateItem('olAppointmentItem');
appointment.Subject = 'My Subject';
appointment.Body = 'Appointment in MATLAB';
appointment.Start = '13/01/2022 09:00:00';
appointment.End = '13/01/2022 09:30:00';
appointment.RequiredAttendees = 'one#email.com; two#email.com';
appointment.Save();
appointment.Send
out.release;

You should be able to turn off the ResponseRequested property, from the docs:
https://learn.microsoft.com/en-us/office/vba/api/outlook.appointmentitem.responserequested
Returns a Boolean that indicates True if the sender would like a response to the meeting request for the appointment. Read/write.
i.e. in your case, appointment.ResponseRequested = false;

Related

how to send email using lua programming language?

Can someone please give detailed explanation on how to send an email using lua, and please share a template.
Should the follow the same procedure to send mail using gmail account? I'm on windows 10 and using lua 5.1.
Scenario: I have a lua function from where I need to send mail to few users. Any help in implementing this will really help.
Thank you.
From: http://w3.impa.br/~diego/software/luasocket/smtp.html
smtp.send{
from = string,
rcpt = string or string-table,
source = LTN12 source,
[user = string,]
[password = string,]
[server = string,]
[port = number,]
[domain = string,]
[step = LTN12 pump step,]
[create = function]
}
This describes the function smpt.send which takes a single table as argument.
The fields in square brackets are optional.
Read the docs for details.
The following example shows how to send an email. Notice how the table fields of smtp.send's argument are filled with values. You have to change those values for your use case. Not sure what can be unclear about this.
If you cannot make sense of it as you lack the necessary Lua knowledge I suggest you do a beginners tutorial and read both the Lua Reference Manual and Programming in Lua
-- load the smtp support
local smtp = require("socket.smtp")
-- Connects to server "localhost" and sends a message to users
-- "fulano#example.com", "beltrano#example.com",
-- and "sicrano#example.com".
-- Note that "fulano" is the primary recipient, "beltrano" receives a
-- carbon copy and neither of them knows that "sicrano" received a blind
-- carbon copy of the message.
from = "<luasocket#example.com>"
rcpt = {
"<fulano#example.com>",
"<beltrano#example.com>",
"<sicrano#example.com>"
}
mesgt = {
headers = {
to = "Fulano da Silva <fulano#example.com>",
cc = '"Beltrano F. Nunes" <beltrano#example.com>',
subject = "My first message"
},
body = "I hope this works. If it does, I can send you another 1000 copies."
}
r, e = smtp.send{
from = from,
rcpt = rcpt,
source = smtp.message(mesgt)
}

How to send message later in bot framework?

I want my bot to be able to send some replies later. Like in alarm clock, when user says, ping me at 5 AM then I want to send message to the user at 5 AM. How can I send message without receiving one?
You'll need to receive at least one message so that you know the recipient's address. You'll need to save the addressing info from the incoming message. I think the easiest way is to save the whole message.
Nodejs:
var reply = session.message; // address: reply.address
// ...
reply.text = 'Wake up!';
bot.send(reply);
C#:
var reply = activity.CreateReply(""); // reply.Recipient, reply.Conversation, etc.
// ...
reply.Text = "Wake up!";
ConnectorClient connector = new ConnectorClient(new Uri(reply.ServiceUrl));
await connector.Conversations.ReplyToActivityAsync(reply);
Without reply to an activity request, you can send a message to him like the following. I should mention that you must have the user's Id, and it means at least the user should have sent a message to the bot, to store his id.
string userId ="123456789"; // For Example
string serviceUrl = "https://telegram.botframework.com"; // For Example
var connector = new ConnectorClient(new Uri(serviceUrl));
IMessageActivity newMessage = Activity.CreateMessageActivity();
newMessage.Type = ActivityTypes.Message;
newMessage.From = new ChannelAccount("<BotId>", "<BotName>");
newMessage.Conversation = new ConversationAccount(false, userId);
newMessage.Recipient = new ChannelAccount(userId);
newMessage.Text = "<MessageText>";
await connector.Conversations.SendToConversationAsync((Activity)newMessage);
The above code comes from here.

Setting up Email notification with private message on web2py

I set up a website using web2py and I'm looking for help to setup an email notification that will email the the person when they get a private message.
I already have the system able to have a semi message system/private message and I'm wondering how do I integrate that all together so that if a person gets a message, the system can automatically email that user. I been looking around to how to set it up but no luck for myself.
Thank you.
Edit: Before I start trying to integrate the messaging system, I wanted to test it out with the registration since that's the only thing I could find about web2py and email notification.
Edit2: Got the register to work and it says "email is sent". However, no actual email is sent.
This is all in the Models, menu.py. Also tried putting this in the controller, default.py.
auth.settings.register_next = URL('Welcome')
def Welcome():
User_Email = auth.user.email
mail.send(User_Email,'Welcome To website','Welcome To website')
if request.vars.lan == 'En':
redirect('index',vars={'lan':'En'})
else:
redirect('index')
#from gluon.tools import Mail
#mail = Mail()
#mail.settings. = True
#mail = auth.settings.mailer
mail = auth.settings.mailer
mail.settings.tls = False
mail.settings.server = "tls://smtp.gmail.com:587"
mail.settings.sender = "...#gmail.com"
mail.settings.login = "...#gmail.com:password"
# sends an verification e-mail upon registration
auth.settings.registration_requires_verification = True
def send_email(user, subject):
message = "" "Multi line string for %(first_name)s......"
message = open("somefile.html", "r").read()
# you also have the option to include everyone in bcc=[...]
mail.send(to=user.email,
subject=subject,
message=message % user)
user = db(db.auth_user).select()
for user in user:
send_email(user, "some subject")
Also have in the controller/default.py
def login():
auth.settings.registration_requires_verification = True
auth.settings.registration_requires_approval = False
auth.settings.reset_password_requires_verification = True

Send emails in buildbot

mn2 = MailNotifier(fromaddr="buildbot#example.org",
sendToInterestedUsers=False,
mode = 'all',
extraRecipients=['my#gmail.com'])
I tried using the above code to send email. But it does not send any notification to my gmail account. What might be the problem?
You seem to be missing an important property, relayhost. Your log probably has errors in it from where it tries to send, but gets rejected. He're an example from one of my masters:
buildbot.status.mail.MailNotifier(
fromaddr = from_email,
sendToInterestedUsers = False,
extraRecipients = ['me#mydomain.com'],
mode = 'change',
relayhost = 'relay.mydomain.com')

setting up script to include google docs form data in email notification

I've setup a form using googledocs. I just want to have the actual data entered into the form emailed to me, as opposed to the generic response advising that the form has been completed.
I have no skill or experience with code etc, but was sure i could get this sorted. I've spent hours+hours and haven't had any luck.
My form is really basic.it has 5 fields. 4 of which are just text responses, and one multiple choice.
I found this tute online (http://www.labnol.org/internet/google-docs-email-form/20884/) which i think sums up what i'm trying to do, but have not been able to get it to work.
from this site i entered the following code:
function sendFormByEmail(e)
{
var email = "reports.mckeir#gmail.com";
var subject = "Google Docs Form Submitted";
var s = SpreadsheetApp.getActiveSheet();
var headers = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];
var message = "";
for(var i in headers)
message += headers[i] + ' = '+ e.namedValues[headers[i]].toString() + "\n\n";
MailApp.sendEmail(email, subject, message);
}
To this, i get the following response: ->
Your script, Contact Us Form Mailer, has recently failed to finish successfully. A summary of the failure(s) is shown below. To configure the triggers for this script, or change your setting for receiving future failure notifications, click here.
The script is used by the document 100% Club.
Details:
Start Function Error Message Trigger End
12/3/12 11:06 PM sendFormByEmail TypeError: Cannot call method "toString" of undefined. (line 12) formSubmit 12/3/12 11:06 PM
Is anyone able to help shed some light on this for me? I'm guessing i'm not including some data neeeded, but i honestly have no clue.
Workaround http://www.labnol.org/internet/google-docs-email-form/20884/
You have to setup app script to forward the data as email.
I'll point to the comment above that solved it for me: https://stackoverflow.com/a/14576983/134335
I took that post a step further:
I removed the normal notification. The app script makes that generic text redundant and useless now
I modified the script to actually parse the results and build the response accordingly.
function sendFormByEmail(e)
{
var toEmail = "changeme";
var name = "";
var email = "";
// Optional but change the following variable
// to have a custom subject for Google Docs emails
var subject = "Google Docs Form Submitted";
var message = "";
// The variable e holds all the form values in an array.
// Loop through the array and append values to the body.
var s = SpreadsheetApp.getActiveSheet();
var headers = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];
// Credit to Henrique Abreu for fixing the sort order
for(var i in headers) {
if (headers[i] = "Name") {
name = e.namedValues[headers[i]].toString();
}
if (headers[i] = "Email") {
email = e.namedValues[headers[i]].toString();
}
if (headers[i] = "Subject") {
subject = e.namedValues[headers[i]].toString();
}
if (headers[i] = "Message") {
message = e.namedValues[headers[i]].toString();
}
}
// See https://developers.google.com/apps-script/reference/mail/mail-app#sendEmail(String,String,String,Object)
var mailOptions = {
name: name,
replyTo: email,
};
// This is the MailApp service of Google Apps Script
// that sends the email. You can also use GmailApp here.
MailApp.sendEmail(toEmail, subject, message, mailOptions);
// Watch the following video for details
// http://youtu.be/z6klwUxRwQI
// By Amit Agarwal - www.labnol.org
}
The script utilized in the example is extremely generic but very resilient to change because the message is built as a key/value pair of the form fields submitted.
If you use my script you'll have to tweak the for loop if statements to match your fields verbatim. You'll also want to edit the toEmail variable.
Thanks again for the question and answers. I was about to ditch Google Forms as the generic response was never enough for what I was trying to do.
Lastly, in response to the actual problem above "toString of undefined" specifically means one of the form fields was submitted as blank. If I had to guess, I would say the author only used this for forms where all the fields were required or a quick undefined check would've been put in place.
Something like the following would work:
for(var i in headers) {
var formValue = e.namedValues[headers[i]];
var formValueText = "";
if (typeof(formValue) != "undefined") {
formValueText = formValue.toString();
}
message += headers[i] + ' = '+ formvalueText + "\n\n";
}
I haven't tested this precisely but it's a pretty standard way of making sure the object is defined before trying methods like toString() that clearly won't work.
This would also explain Jon Fila's answer. The script blindly assumes all of the header rows in the response are sent by the form. If any of the fields aren't required or the spreadsheet has fields that are no longer in the form, you'll get a lot of undefined objects.
The script could've been coded better but I won't fault the author as it was clearly meant to be a proof of concept only. The fact that they mention the replyTo correction but don't give any examples on implementing it made it perfectly clear.
If this is a Google Form, do you have any extra columns in your spreadsheet that are not on the form? If you delete those extra columns then it started working for me.
You don't need to use a script. Simply go to Tools >> Notification Rules on your Google Spreadsheet. There you can change the settings to receive an email with your desired information every time the document is changed.