Mime_content in reply email (exchangelib, python) - python-3.x

First - I use the exchangelib package to connect to EWS exchange.
I will create a reply to the email as follows:
msg = acc.inbox.all().order_by('-datetime_received')[-1]
mgs.reply_all("Re: Subject", "body of email")
But the response created this way doesn't have the mime_content option, which I need to be able to save the email as .eml or .msg.
The msg variable has mime_content.
Is there a way to create an email reply with mime_content?
Thanks a lot!

reply_all() does not return anything. It's just a helper for sending a reply to the email it's called on.
If you want to access the Message item that the reply created, you need to search your "Sent" folder for the reply. That message has the mime_content field you're looking for.
If you call msg.create_reply_all(subject, body).send() instead, then you should get back the ID of the item stored in the "Sent" folder so you don't have to search for it.

Related

Prevent forwarding or replying to email

Is there a way to prevent an external recipient from replying to an email, we need them to update our portal. In the ReplyTo Field we add "please update our portal with your response" but many users ignore it by changing the ReplyTo Field.
We create the problem as we add a full description of our customer update in the body rather than just adding a link. I don't really wish to remove this additional information as it is more user friendly. Access to the portal and their 'ticket' is extremely user friendly, one click, it is just people being lazy.
This is how the email is generated.
Many thanks for any suggestions.
var recipient = document1.getItemValueString("emailField");
var sendergroup = "support#ourcompany.co.uk";
var memo = database.createDocument();
memo.appendItemValue("Form","Memo");
//memo.appendItemValue("Principal","Support Request#NotesDomain");// Don't use.
memo.appendItemValue("From",sendergroup);
memo.appendItemValue("INetFrom",sendergroup);
memo.appendItemValue("ReplyTo","... please update our portal with your response.");
memo.appendItemValue("DisplaySent",sendergroup);
memo.appendItemValue("SMTPOriginator",sendergroup);
memo.appendItemValue("Subject", Our references here ");
var rtitem:NotesRichTextItem = memo.createRichTextItem("Body");
var rtStyle:NotesRichTextStyle = session.createRichTextStyle();
rtitem.addNewLine();
rtitem.appendText("Hi "+firstname+",");
rtitem.addNewLine();
rtitem.appendText("Details of the request in here..");
rtitem.addNewLine();
rtitem.appendText("https://link to their document in here");
memo.send(recipient);
As far as I know you cannot control what happens at the recipient's mail system....
However, you could use a sender/reply address where the mail goes to a mailin database where you could have an agent send them a reply stating that their reply is ignored and that they will have to open the link....
Not ideal - but then at least they know :-)

Netsuite REST API for email communications

I am trying to find where in the NetSuite REST API the communication messages are stored. I have looked at messages but the list returns 0 even though there are a lot of emails that have been sent. Guessing I'm looking in the wrong place but not sure what path the records are in.
Also once I get the emails, is there a way to extract the attachments sent in the emails to download using the API?
Thanks!
You can execute a SuiteQL query.
POST https://[account].suitetalk.api.netsuite.com/services/rest/query/v1/suiteql
Header: Prefer: transient
Body:
{
"q": "SELECT id, authoremail, subject, datetime FROM message"
}
However, adding the attachments field to the search results to an unexpected error.
The record and field IDS are in the Analytics browser: https://[account].app.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2020_1/analytics/record/message.html.

IFTTT Webhooks - Not receiving email (but the response says that it was sent)

I'm following this tutorial to send email in App Inventor: https://www.hackster.io/taifun/trigger-ifttt-to-send-an-email-using-app-inventor-9df505 (You will have to scroll down on the page to view the tutorial)
The tutorial is straight forward and easy to understand. However, the IFTTT service (Maker) is now called "Webhooks".
I don't know what else has changed since that tutorial was written.
Following the tutorial:
the URL is correct https://maker.ifttt.com/trigger/Sendmail/with/key/*MYKEY*
the RequestHeaders are correct Content-Type: application/json
the PostText is correct: { "value1" : "faeryofiris#gmail.com", "value2" : "test", "value3" : "test body" }
I have double and triple checked for spelling errors.
Once I click a button to send this email, I receive the response:
"Congratulations! You've fired the Sendmail event!"
Except... there is no email. Both emails are my actual emails, so they are valid emails. "faeryofiris#gmail.com" should be the "FROM" email, and "pixiibomb#gmail.com" is the email that is registered on IFTTT (this should be the email that receives a message from faeryofiris) I keep refreshing my gmail, and still... no email.
Any ideas?
I've run into this issue several times. The solution has always been to click "Edit Connection" on the Webhooks Service Settings page. This will get you a new key. It doesn't solve their issue which is that keys tend to die for no explained reason but it should get your setup working again.

Send email from mailbox in Python

currently I am using the win32com.client way of sending emails via Python 3, as I do not have access to SMTP. My code is below for reference:
def send_email(recipient, content, cc):
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = recipient
mail.Subject = content[0]
mail.HTMLBody = content[1]
mail.CC = cc
mail.Send()
My question is, is there a way to send an email using this method but send it 'from' another mailbox from within my outlook. For example, I have my email "name#domain.com" and a mailbox called "application#domain.com", which I have send as rights on. Is there a way to change it so that it'll send from the "application#domain.com" email? I haven't been able to find any documentation on this query.
managed to find the solution! If anybody else needs it, use the property:
newMail.SentOnBehalfOfName = 'SharedFolder'
Thanks to programmatically send outlook email from shared mailbox

How to get body of mail by message-ID or any header

I'm creating an email app. To save time, I just download subject and some header and saved them to database, not download body of mail.
And then, If user click on subject, I will download body of this mail.
I try to use Message-ID (because it's unique) to make it is an index. and Using this code to find this mail on server
SearchTerm term = new MessageIDTerm(ID);
message_s = folder.search(term);
But it just success on GMAIL, some other server, this code doesn't work correct.
I try to get All message-ID and compare it on client side, It toke a lot of time to find, user can't wait too long to get body of email.
Anyone has an idea to find and download body of email correctly by Message-ID or by any header ?

Resources