I am using outlook 2000 with a login id in a exchange server of my company.
I have a folder named "undelivered_email" which in under personal folder. I set a rule to move a copy of all the email with title similar to "undelivered email".
Now, how can I loop through all the email in this "undelivered_email" folder, and access the body of each email, then get any email address inside the content body?
For example, this is a copy of the content of a undelivered email notice:
####################################################################
# THIS IS A WARNING ONLY. YOU DO NOT NEED TO RESEND YOUR MESSAGE. #
####################################################################
Your message could not be delivered for 1 days, 20 hours, 0 minutes.
It will be retried until it is 3 days, 0 hours, 0 minutes old.
For further assistance, please send mail to <postmaster>
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
< abc#xyz.com >: this domain could be reached at this time
Well, I don't really need to use vba, any method will do. Should be the easiest one.
I have a lot of such undelivered email notice to handle, I need to extract the email inside. And it would be good if we can export the email list to a file.
I Googled "outlook vba bounced email" and got some promising hits:
MS Access, Outlook: recording bounced email addresses
Parse email body for email addresses and write them to Excel
Related
I've been in and out of so many Microsoft docs and forums SEARCHING for the answer, I figured I'd just ask.
Long story short - I want to write a macro that, with an email highlighted in the main/mail pane in Outlook ...
Searches the subject line of the email for the case number/UID (always a four digit year, hyphen, and a six digit number, e.g., 2019-012345); and then
runs a basic search (not Advanced Find) in my inbox and all subfolders for any email with that UID in the subject line or body.
I'd offer a jumping off point but Outlook doesn't have a record macro function.
Functionally speaking ... my Outlook search option is set to include results from all folders. I hit Ctrl-E and type in the UID and hit enter to search. Would love to reduce that to one key stroke
Does the code have to get into DASL and MAPI? The extent of my VBA knowledge goes to user forms and template letters so ... I'm in way over my head.
I am working on a project where I need to get ms access table/data from mail body and execute some command in SAP. I can manage SAP part but issue is that how to get information from mail body. i tried linking my mailbox in access but it shows me all mail body text but i need some specified contents only. example
Hello,
Please supplement budget
WBS Amt
N.10002077.001 1
from above what i need is just "N.10002077.001" and "1" ,but how to get that information only in table is the issue?
Further, what I will get in my mail will be table with 2 column but access imports it as a simple text.
It is impossible to give a definite answer to your question because it is too vague but it is possible to get you started.
Have a look at this answer of mine: https://stackoverflow.com/a/12146315/973283. The question is not relevant other than the OP did not understand that showing screenshots told us little about what the body looked like to a VBA macro. The answer includes a macro that copies selected properties from every email in Inbox to an Excel worksheet. This will allow you to see what an email’s body looks like to a VBA macro.
How will you identify the emails from which you wish to extract data? The two simple choices are:
Look at every email in a folder and identify the interesting one by examining the subject, sender or some other property.
Select the interesting emails then run a macro which uses ActiveExplorer to access the selected emails.
The answer referenced above demonstrates technique 1. There are lots of answers demonstrating technique 2 but I can add an example macro if necessary.
An email typically has an Html body and a text body. If an email has an Html body, that is the one shown to the user. A macro can access either or both. Your screen shot looks like a text body although appearances can be deceptive. If it is a text body, the email does not have an Html body.
If it is a text body, the layout of the body is probably something like:
Hello,{cr}{lf}
Please supplement budget{cr}{lf}
WBS{tab}{tab}{tab}{tab}{tab}Amt{cr}{lf}
N.10002077.001{tab}{tab}1{cr}{lf}
This assumes, the sender has used variable numbers of tabs to line up the columns.
You could use Split on vbCr & vbLf to convert the string body into an array of strings with one line per array entry. Discard lines up to and including the line starting “WBS” then process each line down to any signature. Split each line on vbTab and expect to find two entries with values with the rest blank.
See how far you can get with the above hints then clarify your answer if you need more information.
I am currently making a Macro that can send out a bunch of emails with attachments all at once. I did this in outlook, but I'd like to redo it within Excel, so any user can simply press a button on the spreadsheet and it emails out the reports. My issue is certain reports have a special subject for example (Cabana Arrivals till (6 months from date)) in outlook I simply put dateadd("M",6,Date) after the subject my issue is I don't want to 'hard code' this within the loop. My question is when VBA reads the INI file, is there anyway to make the key's data active? So when it reads this key:
Special Instructions=format(dateadd("M",6,date), "MM/DD/YYYY")
the subject will now be "Cabana Arrivals Till 04/07/2016" or is there a totally different way I need to look at this? Any help is appreciated wasn't sure on how to even find the answer to this as I've never heard of doing it before.
Date add would be the only function used so create a key called 'subject date add' and set it equal to the interval (m,d,y) and the # of days/months/year. It should look like ('subject date add' = m,6) split on , and remove spaces for date grab the files modify date. If key does not exist skip.
Some people advice that it is good idea to sent an e-mail in both format html and plain text together in the same e-mail body as following link explains.
https://litmus.com/blog/reach-more-people-and-improve-your-spam-score-why-multi-part-email-is-important
You can see four code options below.
.BodyFormat = Outlook.OlBodyFormat.olFormatHTML
.BodyFormat = Outlook.OlBodyFormat.olFormatPlain
.BodyFormat = Outlook.OlBodyFormat.olFormatRichText
.BodyFormat = Outlook.OlBodyFormat.olFormatUnspecified
You are able to select one option as following picture shows.
http://www.rocketseed.com/wp-content/uploads/2013/07/Outlook-2010-HTML.jpg
How to sent mixed formatted e-mails even your code must include one option?
I need vb.net code for this.
That link does not apply to Outlook: when a message is saved (or sent) all 3 flavors of the message body (plain, HTML, RTF) are synchronized. You cannot send a message from Outlook with either flavor out of sync. You can send plain text messages, html/plain, or RTF (winmail.dat), but you cannot send with plain text body out of sync of the HTML body.
I need a way to get a daily count incoming emails into the INBOX before they get filed into sub-folders. Other than manually counting them, is there a known automated solution?
You can count the number of email received by following the steps given in this link :
http://www.outlook-tips.net/tips/count-total-number-messages-received-today/.
These links can also be useful :
1)http://email.about.com/od/outlooktips/qt/See_Total_Not_Just_Unread_Inbox_Message_Count_in_Outlook.htm
2) http://www.slipstick.com/outlook/rules/count-received-emails/
In the search field type "received:today"
The count of items will appear in the bottom left corner.