How imap.seqno works in nodejs? - imap

My Node app is using imap module to retrieve emails:
var f = imap.seq.fetch('1:3', {
bodies: ['HEADER.FIELDS (FROM TO SUBJECT DATE)', 'TEXT'],
struct: true
});
The app fetches emails with seqno 1-3 in gmail mail box. However I did not see those 3 emails in the mail box and only found them by searching the email subject. It seems the imap module retrieve some real old emails which are not visible in the mail box. I am wondering how seqno is issued in a mail box and weather a seqno for an email is unique and stay unchanged after issuing.

Related

how to get label email from gmail with IMAP?

i have a problem to get label email from Gmail. i was tried using Gmail API. that totally works fine. but that has a problem. gmail API does not have a listener (email idle). so now we using IMAP for getting the email. but i have no idea how to get id email by the label (update,promotions,social etc) with IMAP.
its possible to get id email by label using IMAP?
thanks
Labels are generally mapped to folder names, fairly directly. Each message appears in any IMAP Folder that it is labelled with.
However, GMail has a set of extensions to IMAP documented where you can fetch the labels for a message more directly. They have added a X-GM-LABELS item for FETCH and STORE.
Here's there an example there:
a010 FETCH 1:4 (X-GM-LABELS)
* 1 FETCH (X-GM-LABELS (\Inbox \Sent Important "Muy Importante"))
* 2 FETCH (X-GM-LABELS (foo))
* 3 FETCH (X-GM-LABELS ())
* 4 FETCH (X-GM-LABELS (\Drafts))
a010 OK FETCH (Success)
Note special/system labels are prefixed with a \.

Office365 API append email signatures based on senders email address

We are considering using Office365 API to send our emails. One reason we are considering Office365 is to be able to automatically apply signatures. So if we send automated email for a specific user, are we able to specify that we want the signature appended to that email?
Would we be required to use the user credentials for the user we are sending with, or are there Admin roles available allowing use to pick / automatically apply the correct email signature?
Thanks,
AFAIK, you can't choose/apply different signature when sending email to specific user with O365 API. As a workaround, with outlook mail rest api ,you could create an email message , inserts an email signature into the end of email message body when sending to a specific user. You could use a HTML body for your email message,for example :
// Create the email message text body.
string htmlBodyTxt = #"<html><head></head><body><p>This is the email message body before a signature is added.</p>
</body></html>";
// Identify the signature insertion point at the end of the HTML body.
int signatureInsertPnt = htmlBodyTxt.IndexOf("</body>");
// Create the email signature.
string signature = "<p>Dallas Durkin<br/>Senior Planner<br/>Adventure Works Cycles</p>" +
"<p>4567 Main St.<br/>La Habra Heights, CA 90631</p><p>(323) 555-0100</p>";
// Insert the signature into the HTML body.
string newBody = htmlBodyTxt.Insert(signatureInsertPnt, signature);

Send an email from my app without using MFMailComposeViewController

Is it possible to send an automatically generated email using my own email address to another email address of mine by clicking a button?
I tried to use MFMailComposeViewController but another view appeared. Can I do it without this view?
You can do it only by creating own server-side mailer. On button clicking you have to send request with all needed data (email address, body, subject, etc) and server will send mail.
If You want send directly from app - MFMailComposeViewController is the only LEGAL way
By default in iOS you can only use the MFMailComposeViewController, which uses the user's mail account. Therefore you cannot send fully automated mail messages (the user allways has to confirm/cancel).
libMailCore is a great iOS framework which allows you to generate and send mails without any user interferance. In that case you'll be using your own server/credentials (thus not the user mail account). There are apps in the App Store using mailcore, so i would guess it's legit.
Yes there is a way using Swift-SMTP.
Send email
Create a Mail object and use your SMTP handle to send it. To set the sender and receiver of an email, use the User struct:
let drLight = Mail.User(name: "Dr. Light", email: "drlight#gmail.com")
let megaman = Mail.User(name: "Megaman", email: "megaman#gmail.com")
let mail = Mail(
from: drLight,
to: [megaman],
subject: "Humans and robots living together in harmony and equality.",
text: "That was my ultimate wish."
)
smtp.send(mail) { (error) in
if let error = error {
print(error)
}
}

how to receive mail and send notification to the user in rails?

I have been trying to receive emails in rails using IMAP and send a notification to user that new mail has come. I have a table namely "email" where i have to store the email information like message_from, message_to, message and i wanted to know how to fetch the emails from the gmail whenever a new mail comes in. And the following is the code
require 'net/imap'
require 'net/http'
imap = Net::IMAP.new('imap.gmail.com', 993, usessl = true, certs = nil, verify = false)
imap.login('sampleuser', 'password')
imap.select('INBOX')
imap.search(["NOT", "SEEN"]).each do |message_id|
emails = imap.fetch(mail,'RFC822')[0].attr['RFC822']
#mail = Email.new("from" => emails.from, "to" => emails.to)
#mail.save
end
but i cannot able to fetch the message_from or message_to or the message, it shows error as
TypeError (can't convert Symbol into Integer):
how can i get those details and i want to send notification to the user when a new entry is created in the table and clicking on that should take it to the page where i have to display the email.
How can i do this and should i be using something like scheduler to check if the new mail has come and if i am not reading the mail how can i identify that i have received the mail already and i do not want to duplicate. Please help me.
Your best bet on receiving emails is Griddler. It's easy to setup
You can send the email to the model you want and do the processing there.

how to share a link via sms in blackberry

I am building an application where I need the option to share via email and SMS.
I have done the share via Email, where when the user selects the image, the url is passed as the content of the email. But while sharing via SMS, I can't do something like setContent as I did for email and fetch the url in the SMS directly, instead of user typing the address manually.
I am using Message class in email and MessageConnection class for SMS, as shown in the blackberry community example.
The Message object you receive when calling MessageConnection.newMessage(TEXT_MESSAGE) is actually a TextMessage object (or a BinaryMessage object with BINARY_MESSAGE).
If you cast the received object to the proper class (TextMessage or BinaryMessage), you should be able to use its setPayloadText(String data) (or setPayloadData(byte[] data) for a BinaryMessage) to enter a value in the message before sending it.
Your code should look like this:
Message msg = myMessageConnection.newMessage(TEXT_MESSAGE, /* address */);
TextMessage txtMsg = (TextMessage)msg;
txtMsg.setPayloadText(/* Text to send */);
myMessageConnection.send(msg);
When you send an email, you can set the body of it and send it to the user from the Email native application. You cant do taht for SMSs. I worked on that issue and for BB Torch I was able to set the text of the SMS message but for other devices that was impossible. I always obtain an empty text message!!
So y suggestion to you is using the following code wich will send the SMS to a number without the interference of the user
MessageConnection conn = (MessageConnection) Connector.open("sms://" + userNumber);
TextMessage txtmessage = (TextMessage) conn.newMessage(MessageConnection.TEXT_MESSAGE);
txtmessage.setPayloadText(text);
conn.send(txtmessage);

Resources