As mentioned in the RFC3501 the max value of UID assigned to each mail is "4,294,967,296 (Non-zero unsigned 32-bit integer)", so what would happen if that UID value is crossed?
I am planning to fetch emails from IMAP server based on last UID fetched
imap.fetch(`${lastUID}:*`,cb)
As I understand, fetching mails using the last UID logic is most inclusive way of fetching new or recent mails for all type of email accounts (Gmail, Outlook) since Gmail does not allow the use of \Recent flag. So what will be the case when the UID reaches its maximum value and how can that situation be handled?
Related
I need to fetch emails in batches from a mail box which has been through several migrations.
There was an email provider before, then the mail box was migrated to gmail and then to O365.
When I try to use UID, the emails are not fetched in reverse date order.
like this: IMailFolderObject.Fetch(startingUID, EndUID, MessageSummaryItemsObject);
To get emails in reverse date order through Mailkit, I tried to following.
var list = IMailFolderObject.Fetch(0, -1, MessageSummaryItems.Envelope | MessageSummaryItems.UniqueId).ToList();
list.Sort(new OrderBy[] { OrderBy.Date });
The emails are fetched but it takes a real long time to complete the job. Since the mailbox is really large.
I do not want to retrieve all the emails and sort them in my program.
Is there a way to get top 50 emails (sorted by date descending since I can not guarantee the UID order is not matching the order of date descending)
and the rest in batches of 50 in subsequent calls ?
Thanks for help in advance.
This is my first question so please let me know should there be more information.
I have the accessToken of the logged in user and currently my query looks like below
https://xxx.salesforce.com/services/data/v45.0/query?q=SELECT Id,Name,Industry,Ownership,AnnualRevenue,NumberOfEmployees,Phone,Website FROM account ORDER BY LastModifiedDate DESC LIMIT 10
The above query will return last 10 modified accounts that the loggedin user has access to. What I want is to get only those accounts that are assigned to the logged in user.
You need a query similar to
SELECT Id, Name
FROM Account
WHERE OwnerId = '005...'
ORDER BY LastModifiedDate DESC
LIMIT 10
All users' ids in all SF instances in the world start with 005.
You can get the user id from the login success response. Which OAuth2 flow you've used? https://help.salesforce.com/articleView?id=sf.remoteaccess_oauth_user_agent_flow.htm&type=5 ?
In that example the user's id is hidden in the OAuth "id" field (identity, service that returns some info about the user. name, email, preferred language, locale, timezone...)
https://www.customercontactinfo.com/user_callback.jsp#
access_token=00Dx0000000BV7z%21AR8AQBM8J_xr9kLqmZIRyQxZgLcM4HVi41aGtW0qW3JCzf5xd
TGGGSoVim8FfJkZEqxbjaFbberKGk8v8AnYrvChG4qJbQo8&
refresh_token=5Aep8614iLM.Dq661ePDmPEgaAW9Oh_L3JKkDpB4xReb54_pZfVti1dPEk8aimw4Hr9ne7VXXVSIQ%3D%3D&
instance_url=https://yourInstance.salesforce.com&
id=https://login.salesforce.com%2Fid%2F00Dx0000000BV7z%2F005x00000012Q9P&
issued_at=1278448101416&
signature=miQQ1J4sdMPiduBsvyRYPCDozqhe43KRc1i9LmZHR70%3D&
scope=id+api+refresh_token&
token_type=Bearer&
state=mystate
It's bit hard to see but if you would receive this response you need to extract the 005x00000012Q9P part. If you don't trust parsing that url - well, call that "id" endpoint. See https://salesforce.stackexchange.com/q/11728/799 for response format and some more ideas.
I am using MailKit to retrive emails from a Gmail account. However, I have been confused about the Id of an email.
I already looked at the documentation but could not find a complete explanation.
For example, I noticed UniqueId, is actually not unique; I mean if I move an email to a particular folder and fetch that email it has an Id (say 1). Then if I remove that email from the folder and add it again to the folder it gets andother UniqueId (e.g., 2)!
When I try to get MessageSummaryItems.Id the value for my emails are null.
The value for MessageSummaryItems.GMailMessageId is a big number that I don't know if it is realy uniquely assigned to that email.
The value for MessageSummaryItems.Envelope.MessageId seems a globally unique Id for that email.
I want more explanation about these Ids?
GMail does not support the OBJECTID extension, so MessageSummaryItems.Id will never get anything (e.g. the returned IMessageSummary.Id will always be null).
MessageSummaryItems.Envelope.MessageId is the Message-Id header value.
MessageSummaryItems.GMailMessageId is a GMail-specific identifier that is similar to the UniqueId but is globally unique for your account.
A UniqueId is a unique identifier, but is folder-specific. In other words, a message with a UniqueId of 5 in your INBOX folder will be different from the message with a UniqueId of 5 in your Starred folder, for example.
However, on GMail, a message in your INBOX with a GMailMessageId of 5 will be identical to a message in your Starred folder with the same GMailMessageId. They will both refer to the exact same message.
To understand why this is, GMail really only has 1 folder (All Mail) where all of your messages are located. All of your other folders, including INBOX, Drafts, Sent, etc. are just virtual views of the All Mail folder that filter out all messages that do not have the corresponding GMail Label.
That's why if you add a label to a group of messages, they will show up in your INBOX and in a new folder that gets created that matches the name of the label that you just created.
Once someone clicks on the fulfill button on the Sales Order I want it to send an email to someone.How can make this occur in Netsuite?
You can create a custom workflow on sales order and configure the worflow to send email to the specific email id. The email id can be either custom one / a field value from the sales order record (ex. customer, salesperson etc.,)
The condition for the workflow will be
OldRecord.Status!="Pending Fulfillment" && NewRecord.Status!="Pending Fulfillment"
Thanks
Frederick D
you can write a user event on Item Fulfillment record type and send email using nlapiSendEmail()
You may want to put a check in script if type == 'create' to avoid sending email on other record operation.
Registered users were created first, then Simplenews was added.
How to set up mailing to all already registered users?
I get that you can send emails only to those who joined after you install the module. But I need the existing users' addresses included also.
I found a solution only cure addresses from the database, then export, and put them in a mass subscription.
I just did the following successfully on an up-to-date Simplenews module, with a 3000+ user base. The answer comes from http://cc.com.au/2010/02/03/drupal-simplenews-mass-subscribe
So what I do first is select the uid and email address for all authenticated users (the anonymous user has uid 0, so I select only users with a higher uid) and insert those into the simplenews_subscriptions table.
INSERT INTO simplenews_subscriptions(activated,mail,uid) SELECT 1,mail,uid FROM users WHERE uid > 0 ORDER BY uid ASC;
This automatically assigns a snid (subscription id) to each entry. You'll notice that rather than selecting a column value into the activated field, I just set it to 1.
Next, I need to find the taxonomy term ID (tid) for the particular newsletter to which I want to subscribe all users. You can find this either by listing the terms in the Newsletter vocabulary or by listing all newsletters. In both cases the term id will be shown in your web browser's status bar if you hover the mouse over the edit link: http://example.com/admin/content/simplenews/types/edit/42
On my Drupal site the tid is 42, so that is the newsletter number I want to subscribe my users to. I need to refer to them via the automatically assigned snid from the simplenews_subscriptions table, so I select that and insert it directory into the simplenews_snid_tid table, together with the correct tid.
INSERT INTO simplenews_snid_tid(snid,tid) SELECT snid,42 FROM simplenews_subscriptions;
D7 Solution
To add all users that are not already subscribers run this query
insert into simplenews_subscriber(activated, mail, uid) select 1, mail, uid from users where uid not in (select uid from simplenews_subscriber) and uid > 0;
And to subscribe them to a newsletter run this query
insert into simplenews_subscription(snid, tid, status, timestamp, source) select snid, 31, 1, unix_timestamp(), 'manual' from simplenews_subscriber where snid not in (select snid from simplenews_subscription);
Remmember to replace the number 31 by the number of your newsletter.
You should be able to implement this using Views, VBO and Rules.
Create a view that lists your users (with filters, if you want), create a rules component that receives a user as argument and then subscribe the mail address of that user using the provided action (make sure you've enabled the simplenews rules module).
Then enable bulk operations on the view with that rules component.
Credit #Berdir https://www.drupal.org/project/simplenews/issues/1564988