I'm working on an application that captures some Outlook events. Is it possible to detect the event when an email is sent. I don't mean when the user clicks on "send" button but when the email is actually sent and is no more in the outbox. Thanks in advance.
UPDATE
I managed to capture the Items.ItemAdd event on the sent mails folder. In order to check whether the last email added to the sent items folder is the one I'm interestd in I tried this :
STDMETHODIMP CItemsEventListener::HandleItemAdd(CString p_date, CString p_time)
{
CComPtr<Outlook::_Application> spApplication;
CComPtr<Outlook::_NameSpace> spSession;
CComPtr<Outlook::MAPIFolder> spSentMailsFolder;
CComPtr<Outlook::_Items> pSentboxItems;
spSentMailsFolder->get_Items(&pSentboxItems);
CComPtr<Outlook::_MailItem> pSentMail;
pSentMail = pSentboxItems->GetLast();
//do staff
return S_OK;
}`
I'm getting compiler error :
error C2660: 'Outlook::_Items::GetLast' : the function doesn't take 0 arguments
Which argument should I pass to the function?
MailItem.Send and Application.ItemSend events occur before the message is actually sent.
To capture when a message is actually sent, use the Items.ItemAdd event on the Sent Items folder.
Related
I use - is_valid = validate_email(e) for validating email. It can detect if '#' is not present or some more but not providing whether the email entered is active now. AND I used sendmail for sending email. I used try except block. Mail is sending but sometimes try code running and someother times except block is running. How to avoid this abnormal behaviour.
if i correctly understand your question..
There is an option called emailfield in djangoforms.it will show validation error if # is not present.
field_name = forms.EmailField(**options)
I'm using a lambda function to customize confirmation emails with AWS Cognito. My lambda function seems to work fine and looks like this:
exports.handler = async (event, context, callback) => {
const sampleTemplate = `<html>
<body>
<div>${event.request.codeParameter}</div>
<div>${event.userName}</div>
</body>
</html>`
if (event.triggerSource === "CustomMessage_AdminCreateUser") {
event.response.emailSubject = 'Lets hope this works'
event.response.emailMessage = sampleTemplate
console.log(event.response) // Logs look as expected
}
callback(null, event);
};
The problem is that when the emails arrive the message body is being overwritten by the content in the User Pools > Message Customizations tab. The subject line is working fine, but the email body is being overwritten. For example, the cognito settings look like this:
And the emails look like this:
As you can see, the lambda function worked for setting the email's subject line, but not the actual content. I can't find any setting to turn off that content and it can't be left blank... Any help is much appreciated.
For anyone finding this, I was able to find the answer. When using the CustomMessage_AdminCreateUser event, cognito will silently throw an error if you use event.userName in the template. Instead use event.request.usernameParameter and it will work
If after doing everything, your custom email template doesn't show up then check the following:
Verification type is set to "code" not "link". ( Your Pool > General settings > message customizations ) Ref: https://github.com/amazon-archives/amazon-cognito-identity-js/issues/521#issuecomment-358383440
Email HTML template shouldn't exceed more than 20,000 UTF characters. Ref: https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-custom-message.html#aws-lambda-triggers-custom-message-example
Check this tutorial - https://medium.com/#hasnat_33856/customize-your-cognito-verification-emails-with-html-pages-using-lambda-function-e6fff7ebfb94
We MUST include both the "{username}" and "{####}" placeholder for the custom template for CustomMessage_AdminCreateUser to work. We can place this ourselves in the html file or via the event object's values for the keys event.request.usernameParameter and event.request.codeParameter respectively.
In summary, the html file for CustomMessage_AdminCreateUser must include these two values:
event.request.usernameParameter (has value "{username}") and
event.request.codeParameter (has value "{####}")
I have a situation where I have a python client try to send a message to a server using SocketIO. I'm using sock.emit to send a json message as shown below
sock = SocketIO(url, None, ...)
message = {'ob': 'house',
'ids': ['54fjadb70f9756','39f1ax451f6567']}
self.sock.emit(message)
server expects the follow:
{"ob":"house","ids":['54fjadb70f9756','39f1ax451f6567']}
the server is current receive the following message:
{"args": [], "name": "{\"ids\": [\"54fjadb70f9756\", \"39f1ax451f6567\"], \"ob\": \"house\"}"}
then complains about an invalid message.
How would I send the message so that the server receives it as expected i.e which the original message structure I specified? it seems emit is changing the structure of the message when I send it, is it possible to override and change emit to that it retain the original message structure? is so how would I do that?
Socket.io .emit() takes two arguments. The first argument is a message name which should be a plain string. The second argument is optional and can be data which will be JSON encoded data.
So, you are trying to send your data as the message name. That will not work. You need to create a message name and send the data as the argument for that message name.
sock = SocketIO(url, None, ...)
message = {'ob': 'house',
'ids': ['54fjadb70f9756','39f1ax451f6567']}
sock.emit("someMessageName", message)
Then, on the server, you need to have a listener for that specific message name and then you can receive the data when that message listener is invoked.
I am trying to automate the sending of a message on a shoutbox :
http://www.i-tchat.com/shoutbox/shoutbox.php?idShoutbox=116303
When i'm using this code every thing work fine (without error) but the message is not send (submited)
from twill.commands import *
url='http://www.i-tchat.com/shoutbox/shoutbox.php?idShoutbox=116303'
user= 'Toto'
mess="Test message"
go(url)
formclear('1')
fv("1", "username", user)
fv("1", "message", mess)
showforms()
submit('0')
Any Idea ?
try
submit(url)
when you press the submit button you are redirected back to the same page, have you read the source code before?
I have an email address "myaddress#gmail.com". I have created a django form that has a text field and a button. I want to redirect anyone who types a message in the text box to their respective emails so that they can send the message they typed to "my address". This means that as they log in to their email accounts, their message boxes should already be filled with the message they typed and the receiver field should already have "myaddress#gmail.com". The problem is how to redirect the users to their email accounts and prefill the specified fields.
Can anyone help me please?
If the user has set a default email program, most of them will be triggered on mailto:. I know gmail works with mailto: as well, and its possible that other web email services might. All desktop email clients - again only if it is set as the default email program will work on mailto:
The format is:
mailto:[emailaddress]?header=value&header1=value1....&headerN=valueN
Here is an example that sets the subject of the email automatically:
Email me