Is there a way to automate reply to a particular message. The process here is that you make a request through, eg. outlook, and then reply to the response of the request you made.
Yes, you make your application periodically check for mail in the inbox using POP3 or IMAP and do something if there's a message that matches with the format of your request.
Something like (not actually a working example, more like pseudo code)
mail=Mail.login(:server => 'foo',
:user => 'john',
:password => 'john_is_the_king_pimp'
)
while 1==1
mail.new_messages do |msg|
if msg.subject.match(/^REQUEST/)
read stuff from the message and do something about it
end
end
sleep 60
end
Related
I'm trying to send an email to email addresses in a mailing group with the package and procedure below.
xxfr_mail_package.begin_mail ( sender => '<MEKSICO-IYE<noreply#meksico.com>',
recipients => fnd_profile.value('XXPC_PLANNING_MAIL'),
subject => l_subject,
mime_type => 'text/html; charset=iso-8859-9',
priority => '',
cc => l_cc );
fnd_profile.value('XXPC_PLANNING_MAIL') returns email addresses separated by semicolons. In this case, sending emails to each address is seamless.
However, when a group e-mail is given as an argument to the recipients parameter, no e-mail is sent to the e-mail addresses in the group. Since the list of recipients is long, I want to use an email group as an argument.
Is there a solution to this?
The problem has been solved by removing restriction on the distribution list on the Exchange Server side. Thanks for your valuable responses.
I'm trying to write an applescript which will append 'xxx' to the end of the message if I am sending it to my SO. Obviously I don't want to add 'xxx' on every message I send.
I've tried recipient, myBuddy and a few others that I've lost track of and none of them work.
my code is below:
using terms from application "Messages"
on message sent theMessage for theChat
// if recipient is THE MRS
set kisses to " xxx"
set myResponse to theMessage & kisses
return myResponse
end message sent
end using terms from
The on message sent event handler only returns the text of the message and a description (and type of message).
None of these contains the recipient, so you can not get who the message is being sent to. The best you can accomplish is text substitution, say, if you wanted any occurrence of xxx to substitute in for something else.
Remember you can set up text string autocomplete system-wide in System Preferences/Keyboard, to accomplish similar things.
I understand the purpose of this for more complex functionality, but I'm trying to make a simple app that does nothing more than forwards to a phone number. I don't want to hard code the forward via a Twimlet because I want to build a web app that dynamically allows me to assign the numbers. Can someone tell me what I'd put for URL parameter in this situation?
get '/forward-call' do
#client = Twilio::REST::Client.new
#call = #client.account.calls.create(
{:to => "+15127778888",
:from => "+15122222222",
:url => "What in the foo should I put here?"})
end
Twilio developer evangelist here.
Does your /forward-call endpoint get called when someone makes a call to your Twilio number?
If so, you don't want to be calling the REST API right now, you want to respond to the webhook with some TwiML. In your case, you'd want something like this:
get '/forward-call' do
content_type 'text/xml'
"<Response>
<Dial><Number>#{NUMBER_TO_FORWARD_TO}</Number></Dial>
</Response>"
end
Does that help at all? Let me know if I can help out any more at all.
I want to call my Twilio number which hangs up immediately and then calls me back. This is similar (but not identical) to a previous question of mine.
The problem lies with forcing Twilio to hang up.
The ruby code is:
get '/callback' do
to = params['From']
from = 'my Twilio number'
"<Response><Hangup/></Response>"
sleep 5
# set up a client to talk to the Twilio REST API
#client = Twilio::REST::Client.new account_sid, auth_token
#call = #client.account.calls.create(
:from => from, # From your Twilio number
:to => to, # To any number
# Fetch instructions from this URL when the call connects
:url => 'https://dl.dropboxusercontent.com/u/85088004/twilio/twilio.xml'
)
end
This produces a message: "We are sorry but a system error has occurred". The problem lies with the hangup instruction. I have tried as above and also
<Response><Hangup/></Response> #without enclosing double or single quotes
and
Twilio::TwiML::Response.new do |r|
r.Hangup
end.text
Neither produces the desired result of hangup.
What's wrong?
Many thanks in advance!
Definitely go with #Kevin's advice and get in touch with Twilio support. But one comment I would like to add. At the end of your /callback action, the last value is the #call variable you are assigning when you create a call, Ruby will be trying to return this value as the result of the HTTP request.
Ruby returns the last value evaluated at the end of a method. In this case, that value is what Sinatra responds to the HTTP Get request with by default.
Judging by the literal string you have <Response><Hangup/></Response>, I'm guessing you are not using a view, and expect that to be the result of the get request. You should place that at the very end of your method as below. I've also added a content_type which just sets the response header to say the response is XML.
get '/callback' do
to = params['From']
from = 'my Twilio number'
# set up a client to talk to the Twilio REST API
#client = Twilio::REST::Client.new account_sid, auth_token
#call = #client.account.calls.create(
:from => from, # From your Twilio number
:to => to, # To any number
# Fetch instructions from this URL when the call connects
:url => 'https://dl.dropboxusercontent.com/u/85088004/twilio/twilio.xml')
#ruby returns the last value in a method:
content_type 'text/xml'
"<Response><Hangup/></Response>"
end
Make sure that you have your Twilio Voice Callback set to a Get request as well (the default is post).
I've also removed the sleep 5 that you had in there. I can see where you are going with it. Respond with the hangup TwiML, wait a few seconds, then make a new call. Sadly, Sinatra doesn't quite work that way. It will not respond to the HTTP request until the end of the method. So you're just going to have it sit and wait for 5 seconds with no reason.
This does pose a bit of an issue, as you tell Twilio to make an outbound call to the number that you are about to hangup on, so you basically have a race condition. Does the call disconnect first, or does the outbound start ringing to a busy number.
There are a number of ways of doing this, but I'd suggest a thread. It's a little tricky, but this SO answer goes into some detail.
You should check your Twilio Debugger at twilio.com/user/account/debugger. This will give more information about the failure.
I would like to use Ruby Net::SMTP to send email. The routine
send_message( msgstr, from_addr, *to_addrs )
works well in my code for sending email, but it is not clear from this API how to send email to a list of people that need to be blind copied (bcc:).
Am I missing something, or is it just not possible with Net::SMTP?
The to_addrs parameter of send_message specifies the envelope to addresses. Including an address in to_addrs has no effect on the to and cc addresses that get included in the message header.
To bcc a recipient, include the address in the to_addrs parameter, but don't include it in the headers in msgstr. For example:
msgstr = <<EOF
From: from#example.org
To: to#example.org
Cc: cc#example.org
Subject: Test BCC
This is a test message.
EOF
Net::SMTP.start(smtp_server, 25) do |smtp|
smtp.send_message msgstr, 'from#example.org',
'to#example.org', 'cc#example.org', 'bcc#example.org'
end
This will send an email to three recipients: to#example.org, cc#example.org and bcc#example.org. Only to#example.org and cc#example.org will be visible in the received message.
Yes it's not possible easily with Net::STMP. But there are a really great gem to manage your email sending (http://github.com/mikel/mail). I encourage you to use it.