Question

Jan 30, 2013 at 1:23 PM
Edited Jan 30, 2013 at 1:46 PM

Great code and awesome work.

I have created a Windows Store App (C#, XAML)

I added 2 references to my project HigLabo.Net and HigLabo.Mail.  Everything works great, but I have a question.  I get 11 warnings:

  1. Warning 1 Reference to type 'System.Diagnostics.TraceSource' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.dll', but it could not be found c:\Users\Tony\Downloads\HigLabo20130115\HigLabo3.5\HigLabo.Net.dll MyNewStoreApp
  2. Warning 2 Reference to type 'System.Net.Sockets.Socket' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.dll', but it could not be found c:\Users\Tony\Downloads\HigLabo20130115\HigLabo3.5\HigLabo.Net.dll MyNewStoreApp
  3. Warning 3 Reference to type 'System.Net.Security.RemoteCertificateValidationCallback' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.dll', but it could not be found c:\Users\Tony\Downloads\HigLabo20130115\HigLabo3.5\HigLabo.Net.dll MyNewStoreApp
  4. Warning 4 Reference to type 'System.Net.Sockets.Socket' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.dll', but it could not be found c:\Users\Tony\Downloads\HigLabo20130115\HigLabo3.5\HigLabo.Net.dll MyNewStoreApp
  5. Warning 5 Reference to type 'System.Net.Sockets.Socket' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.dll', but it could not be found c:\Users\Tony\Downloads\HigLabo20130115\HigLabo3.5\HigLabo.Net.dll MyNewStoreApp
  6. Warning 6 Reference to type 'System.Net.Security.RemoteCertificateValidationCallback' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.dll', but it could not be found c:\Users\Tony\Downloads\HigLabo20130115\HigLabo3.5\HigLabo.Net.dll MyNewStoreApp
  7. Warning 7 Reference to type 'System.Net.Security.RemoteCertificateValidationCallback' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.dll', but it could not be found c:\Users\Tony\Downloads\HigLabo20130115\HigLabo3.5\HigLabo.Net.dll MyNewStoreApp
  8. Warning 8 Reference to type 'System.Net.Sockets.Socket' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.dll', but it could not be found c:\Users\Tony\Downloads\HigLabo20130115\HigLabo3.5\HigLabo.Net.dll MyNewStoreApp
  9. Warning 9 Reference to type 'System.Net.Sockets.Socket' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.dll', but it could not be found c:\Users\Tony\Downloads\HigLabo20130115\HigLabo3.5\HigLabo.Net.dll MyNewStoreApp
  10. Warning 10 Reference to type 'System.Net.Sockets.Socket' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.dll', but it could not be found c:\Users\Tony\Downloads\HigLabo20130115\HigLabo3.5\HigLabo.Net.dll MyNewStoreApp
  11. Warning 11 Reference to type 'System.Net.Security.RemoteCertificateValidationCallback' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.dll', but it could not be found c:\Users\Tony\Downloads\HigLabo20130115\HigLabo3.5\HigLabo.Net.dll MyNewStoreApp
    Do you think that I am doing something wrong, or can you make a suggestion?

Thank you so much.

Coordinator
Jan 30, 2013 at 2:15 PM

Probably it is a bug of reference.
I'll check it and modify and upload in a few days.

Thank you.

Jan 30, 2013 at 4:11 PM

Great, thanks much and good work.

From: higty [email removed]
Sent: Wednesday, January 30, 2013 10:15 AM
To: tpalumbo@7vnmotorsports.com
Subject: Re: Question [higlabo:431418]

From: higty

Probably it is a bug of reference.
I'll check it and modify and upload in a few days.

Thank you.

Coordinator
Jan 31, 2013 at 2:44 AM
Hi.

It turns out not to be a bug.
Perhaps your reference is wrong.
Please reference HigLabo.Net.WinRT.dll and HigLabo.Mail.WinRT.dll.
HigLabo.Net.dll is a dll for .NET framework.

regards.
Jan 31, 2013 at 7:28 AM
<div> <div style="font-size:11pt; font-family:Calibri,sans-serif">Ok, will try. Can I still utilize attachments with the WinRt all?<br> <br> Sent from my Windows 8 Phone</div> </div> <div dir="ltr"> <hr> <span style="font-size:11pt; font-family:Calibri,sans-serif; font-weight:bold">From: </span><span style="font-size:11pt; font-family:Calibri,sans-serif"><a href="mailto:notifications@codeplex.com">higty</a></span><br> <span style="font-size:11pt; font-family:Calibri,sans-serif; font-weight:bold">Sent: </span><span style="font-size:11pt; font-family:Calibri,sans-serif">‎1/‎30/‎2013 10:44 PM</span><br> <span style="font-size:11pt; font-family:Calibri,sans-serif; font-weight:bold">To: </span><span style="font-size:11pt; font-family:Calibri,sans-serif"><a href="mailto:tpalumbo@7vnmotorsports.com">tpalumbo@7vnmotorsports.com</a></span><br> <span style="font-size:11pt; font-family:Calibri,sans-serif; font-weight:bold">Subject: </span><span style="font-size:11pt; font-family:Calibri,sans-serif">Re: Question [higlabo:431418]</span><br> <br> </div> <p>From: higty</p> <div id="ThreadNotificationPostBody">Hi. It turns out not to be a bug. Perhaps your reference is wrong. Please reference HigLabo.Net.WinRT.dll and HigLabo.Mail.WinRT.dll. HigLabo.Net.dll is a dll for .NET framework. regards.</div>
Jan 31, 2013 at 3:39 PM
Hello,

Ok,

I removed the following references from my project:
  • HigLabo.Net
  • HigLabo.Mail
and replaced them with
  • HigLabo.Net.WinRT
  • HigLabo.Mail.WinRT
now I am receiving these errors:
  1. Error 'HigLabo.Net.Smtp.SmtpContent' does not contain a definition for 'LoadFileData' and no extension method 'LoadFileData' accepting a first argument of type 'HigLabo.Net.Smtp.SmtpContent' could be found (are you missing a using directive or an assembly reference?)
  2. Error 'HigLabo.Net.Smtp.SmtpContent' does not contain a definition for 'LoadFileData' and no extension method 'LoadFileData' accepting a first argument of type 'HigLabo.Net.Smtp.SmtpContent' could be found (are you missing a using directive or an assembly reference?)
What am I doing wrong?

Thank you.
Coordinator
Feb 1, 2013 at 8:10 AM
WinRT does not provide FileInfo class.
So, HigLabo....WinRT.dll does not has LoadFileData method.
Alternatively you can use LoadData(Byte[]) method and pass bytes.
Feb 1, 2013 at 9:20 PM
I have changed to project and I am attaching files using LoadData(Byte[]) as you recommended. It now works, but it seems that it has caused another issue.

Before I changed the project, I just used a StringBuilder and put together a string that contains HTML for the Body of the email. And it worked fine. Since I changed the project using:

•HigLabo.Net.WinRT
•HigLabo.Mail.WinRT

I get the email with the attachments but the body blank. Here is how I was assigning it:

mg.BodyText = sbEmailBody.ToString();

Any suggestions, or is there something different using the
.WinRT references?
Coordinator
Feb 2, 2013 at 1:23 PM
Please show me entire source code that you created.
I'll review it.

regards.
Feb 2, 2013 at 2:49 PM
Edited Feb 5, 2013 at 12:15 PM
``` Basically this button starts the process then goes in chronological order:


private async void cmdSendReport_Click(object sender, RoutedEventArgs e)
    {      
        CreateSharingBody();
        CreateCSVFileName();
        await CreateAndSendEmail();
    }

}
Coordinator
Feb 4, 2013 at 11:05 PM
Hi.
Show me GetByteFromFile inside of method.

regards.
Feb 4, 2013 at 11:09 PM
Edited Feb 4, 2013 at 11:11 PM
Hello,
private async Task<byte[]> GetByteFromFile(StorageFile storageFile)
        {
            var stream = await storageFile.OpenReadAsync();

            using (var dataReader = new DataReader(stream))
            {
                var bytes = new byte[stream.Size];
                await dataReader.LoadAsync((uint)stream.Size);
                dataReader.ReadBytes(bytes);

                return bytes;
            }
        }  
The files attach fine, it is just the body of the email. It does not show up. It is HTML. It used to work. I don't understand.
Coordinator
Feb 4, 2013 at 11:42 PM
Thank you for your post.
Finally, I found what wrong in my library.
I'll modify and upload it.
Coordinator
Feb 5, 2013 at 1:05 AM
I uploaded new version.
Please check it out!
Feb 5, 2013 at 2:01 AM
Hello,

When I goto http://higlabo.codeplex.com/releases/view/101398
there is no download file. When I try the NuGet, it seems that the HigLabo.Mail.WinRT is not the current version, because I tried and the body of the email is still not showing up.
Coordinator
Feb 5, 2013 at 5:33 AM
Edited Feb 5, 2013 at 5:34 AM
I updated new version.
Please check the dll version number of HigLabo.Mail.WinRT.dll.
It should be 1.2.15.0.
I try this code and work fine.
       using (var cl = new SmtpClient())
        {
            cl.ServerName = "smtp.gmail.com";
            cl.Port = 587;
            cl.Tls = true;
            cl.AuthenticateMode = SmtpAuthenticateMode.Auto;
            cl.UserName = "xxxx@gmail.com";
            cl.Password = "xxxxx";

            SmtpMessage mg = new SmtpMessage();
            mg.Date = DateTime.Now.ToUniversalTime();
            mg["Mime-Version"] = "1.0";
            mg.From = "xxxx@hotmail.com";
            mg.ReplyTo = "xxxx@hotmail.com";
             mg.To.Add(new MailAddress("xxxx@gmail.com"));
            mg.Subject = "WinRT Test";
            mg.BodyText = "<div style=\"font-size:32px;\">Large size</div>";
            mg.IsHtml = true;
            var im = await KnownFolders.PicturesLibrary.GetFileAsync("xxx.png");
            var bb = await GetByteFromFile(im);
            var ct = new SmtpContent();
            ct.LoadData("image/png", bb);
            mg.Contents.Add(ct);

            String text = mg.GetDataText();
            var rs = cl.SendMail(mg);
    }