A tool I wrote in C# that automatically verifies apple accounts. Below is a link to the source code (Visual Studio 2010), however if you meet the following criteria, you can use it without modifying the code.
- Windows computer running .Net 4.0
- Running Exchange 2010
- Know the username and password to the mailbox that the verification email from apple is in, or you know the username and password to an elevated account that has permission to view the mailbox that the verification email from apple is in.
https://www.brandonclaps.com/downloads/AppleAccountVerify.zip – Includes source code too
If you meet the above criteria, unzip and browse to AppleAccountVerify > bin > Release > and run AppleAccountVerify.exe
Code:
1: private void button_Verify_Click(object sender, EventArgs e)
2: {
3: string Log = string.Empty;
4: using (StreamReader sr = new StreamReader(textBox_CSVFile.Text))
5: {
6: string line;
7: while ((line = sr.ReadLine()) != null)
8: {
9: string[] data = line.Split(',');
10:
11: string ExchAuthUsername = data[0];
12: string ExchAuthPassword = data[1];
13: string ExchAuthDomain = data[2];
14: string Exch_User_Email = data[3];
15: string AppleUsername = data[4];
16: string ApplePassword = data[5];
17:
18: string Verify = GetAppleVerifyURL(ExchAuthUsername, ExchAuthPassword, ExchAuthDomain, Exch_User_Email);
19:
20: if (Verify != string.Empty)
21: {
22: WebBrowser web = new WebBrowser();
23: web.ScriptErrorsSuppressed = true;
24: web.Navigate(new Uri(Verify));
25:
26: while (web.ReadyState != WebBrowserReadyState.Complete)
27: {
28: Application.DoEvents();
29: }
30: try
31: {
32: HtmlElement el = web.Document.All["appleID"];
33:
34: el.SetAttribute("value", AppleUsername);
35: el.SetAttribute("text", AppleUsername);
36:
37: HtmlElement el2 = web.Document.All["accountpassword"];
38:
39: el2.SetAttribute("value", ApplePassword);
40: el2.SetAttribute("text", ApplePassword);
41:
42: foreach (HtmlElement el3 in web.Document.All)
43: {
44: if (el3.GetAttribute("className") == "btn bigblue")
45: {
46: if (el3.InnerText.ToLower() == "verify address")
47: {
48: el3.InvokeMember("click");
49: }
50: }
51: }
52: Log = Log + Environment.NewLine + AppleUsername + " - Verified successfully.";
53: }
54: catch (Exception Ex)
55: {
56: Log = Log + Environment.NewLine + AppleUsername + " - " + Ex.Message.ToString();
57: }
58:
59: Log = Log + Environment.NewLine + AppleUsername + " - Finished reading line";
60: }
61: }
62: }
63: Log = Log + Environment.NewLine + " - Complete";
64: textBox_Log.Text = Log;
65:
66: }
Updated 12/29/14 – Updated code below (source code includes update)
1: private static string GetAppleVerifyURL(string ExchangeAuthUsername, string ExchangeAuthPassword, string ExchangeAuthDomain, string EmailAddressToLookIn)
2: {
3: string URL = string.Empty;
4: try
5: {
6: ExchangeService ExchService = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
7: ExchService.Credentials = new WebCredentials(ExchangeAuthUsername, ExchangeAuthPassword, ExchangeAuthDomain);
8: ExchService.AutodiscoverUrl(EmailAddressToLookIn);
9:
10: FolderId InboxID = new FolderId(WellKnownFolderName.Inbox, EmailAddressToLookIn);
11: ItemView view = new ItemView(50, 0, OffsetBasePoint.Beginning);
12: view.OrderBy.Add(ItemSchema.DateTimeReceived, SortDirection.Descending);
13: view.PropertySet = new PropertySet(BasePropertySet.IdOnly, ItemSchema.DateTimeReceived, ItemSchema.Subject);
14: FindItemsResults<Item> findResults = ExchService.FindItems(InboxID, view);
15:
16: if (findResults != null && findResults.Items != null && findResults.Items.Count > 0)
17: foreach (Item item in findResults.Items)
18: {
19: EmailMessage message = EmailMessage.Bind(ExchService, item.Id, new PropertySet(BasePropertySet.IdOnly, EmailMessageSchema.IsRead, ItemSchema.Body, ItemSchema.Subject, ItemSchema.Categories));
20:
21: if (message.Subject.ToLower().Contains("verify your apple"))
22: {
23: string body = message.Body.Text;
24: string[] AfterVerifyText = Regex.Split(body, "To verify this email address belongs to you");
25: string[] BeginningOfURL = Regex.Split(AfterVerifyText[1], "<a href=\"");
26: int Location_EndOfUrl = BeginningOfURL[1].IndexOf('"');
27: URL = BeginningOfURL[1].Substring(0, Location_EndOfUrl);
28: message.IsRead = true;
29: message.Update(ConflictResolutionMode.AutoResolve);
30: }
31: }
32: }
33: catch (Exception)
34: {
35: return URL;
36: }
37:
38: return URL;
39: }
Can you provide the CSV template for this tool.
Thanks,
Create a CSV of txt file (no heading) in the following format with comma separating the fields.
DUN,DUP,DOM,[email protected],AppleID,ApplePW
DUN – Domain username that has permission to view the mailbox for “Email” field. Usually a domain administrator account.
DUP – Domain password for the username above.
Email – Email account to look into for the verification email from apple.
AppleID – The apple username to verify the account.
ApplePW – The apple password to verify the account.
hi admin
I do this and complete appear in right hand
but did not verity.
can you explain it for me with example, thank you so much..
my email is:
[email protected]
123456Us
my appleID is:
[email protected]
123456Us
Is that how your CSV is setup? It should be setup like this:
omiddimo66,123456Us,[email protected],[email protected],123456Us
However, this tool only works with Microsoft Exchange mailboxes.
You make sure that it really works?!!
First, the sample you sent was wrong.
DUN,DUP,DOM,[email protected],AppleID,ApplePW
omiddimo66,123456Us,[email protected],[email protected],123456Us
It’s 6 steps in this tool, you forgot DOM
you say this tool only works with Microsoft Exchange mailboxes but i try it in outlook:
email: [email protected]
pass: 123456Us
and apple ID the same
but it didnot work.
Are you sure you test your tool in first or no ?
I put a lot of time on your application, but did not succeed
My main goal is to make a lot like Apple ID, Can you help me in this case?
thanks a lot
You’re correct, I forgot the domain. However, you’ve listed two domain names that aren’t usually associated with a Microsoft exchange server on premise. It also relies on auto discovery. I encourage you, if you have the means, to debug the application within Visual Studio.
Unfortunately I do not know how Visual studio, Your purpose is not to Yahoo and Outlook?
You did not answer my question, Whether you’re successful with this method, the verify account or Not??
I’ve noticed that you’ve forgotten your domain But even I’ve tested with both domains.
Error was displayed If the domain name is not entered.
You can not test it for me? Or if you like me to test your account
I cannot verify as this relies on an exchange server. It won’t work with Outlook nor Yahoo.
I used this app a few times and it worked great. I just tried it again with just over 100 accounts, and it just sits there for about 5 mins before it pops up a message that says Out of memory at line: 1.
Any ideas?
Is there any more information in the console screen?
Nothing, it just crashses. When I checked memory on the server it was almost maxed out. So I rebooted the server and almost all memory was available, but it still crashed. When I shorten the list down to 20-30 it works fine.
I was going to look at some of the other verify scripts using a mac, but I would much rather use this one.
How much memory do you have? There could be an issue in my code that’s causing a memory leak. But hard to determine without being able to duplicate
In the meantime I have changed my script to create a new log after 40 accounts to keep the file smaller.
But now when it runs I get an error., “Object reference net set to an instance of an object on each account.
Any ideas on that error?
Hi Mike, I sent you an email with some updated code. Here is a link as well.
http://www.brandonclaps.com/downloads/AppleAutoVerify.V2.zip
Version 3 that allows settings for unread emails and how many emails to look back from the most recent
http://www.brandonclaps.com/downloads/AppleAutoVerify.V3.zip
I’m running the script on our mail server which has 32gb of ram.
Great script .
Just having one issue it will not run keep getting a Unhandled exception :-
Just wondering if you could point me in the right direction
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at AppleAccountVerify.Form1.button_Verify_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
—————————————-
AppleAccountVerify
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file://ntcarmcc/home/Home02/JMilligan/Downloads/AppleAccountVerify/AppleAccountVerify/bin/Release/AppleAccountVerify.exe
—————————————-
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
—————————————-
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
—————————————-
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34238 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
—————————————-
System.Data
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
—————————————-
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34234 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
—————————————-
System.Numerics
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
—————————————-
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
Seems like you may have an issue with your CSV files.
Check if you have a blank line or missing a column
Thanks I missed the DOM
Glad you found it.