Click here to Skip to main content
15,886,258 members
Home / Discussions / C#
   

C#

 
AnswerRe: What are Good Things to Know in a C# Interview? Pin
OriginalGriff14-Mar-22 12:29
mveOriginalGriff14-Mar-22 12:29 
AnswerRe: What are Good Things to Know in a C# Interview? Pin
Dave Kreskowiak14-Mar-22 14:36
mveDave Kreskowiak14-Mar-22 14:36 
GeneralRe: What are Good Things to Know in a C# Interview? Pin
lmoelleb14-Mar-22 23:28
lmoelleb14-Mar-22 23:28 
GeneralRe: What are Good Things to Know in a C# Interview? Pin
Member 1227854218-Mar-22 8:25
Member 1227854218-Mar-22 8:25 
AnswerRe: What are Good Things to Know in a C# Interview? Pin
Eddy Vluggen14-Mar-22 14:39
professionalEddy Vluggen14-Mar-22 14:39 
Questionc sharp Pin
vishnu satpathy12-Mar-22 7:26
vishnu satpathy12-Mar-22 7:26 
AnswerRe: c sharp Pin
OriginalGriff12-Mar-22 7:37
mveOriginalGriff12-Mar-22 7:37 
QuestionSend a mail that has Arabic characters using Gmail API Pin
mahmoud199011-Mar-22 11:05
mahmoud199011-Mar-22 11:05 
Iam trying to send a mail using google.Apis.Gmail.v1 and MimeKit, but the issue is that when I use Arabic characters, the receiver receives gibberish text.

My code is below:
var mail = new MimeMessage();
                mail.From.Add(new MailboxAddress("From Name", "DoNotReply@someDomain.com"));
                mail.To.Add(new MailboxAddress("To Name","customerAddress@someDomain.com"));
                mail.Subject = "كشف حساب من تاريخ " + dateTimePicker1.Text + " حتى تاريخ " + dateTimePicker2.Text;
                var text_part = new TextPart(MimeKit.Text.TextFormat.Plain);
                string body = @"<table border='1'><table style='background-color:#E5E4E2;'><tr><tr style='background-color:#1e90ff;color:#ffffff;'><td>تراكمي</td><td>دائن</td><td>مدين</td><td>البيان</td><td>المرجع</td><td>التاريخ</td></tr>";

                foreach (ListViewItem lstitem in listView1.Items)
                {
                    body += @"<tr><td>" + lstitem.SubItems[1].Text + "</td><td>" + lstitem.SubItems[2].Text + "</td><td>" + lstitem.SubItems[3].Text + "</td><td>" + lstitem.SubItems[4].Text + "</td><td>" + lstitem.SubItems[5].Text + "</td><td>" + lstitem.SubItems[6].Text + "</td></tr>";
                }

                body += @"</table></style></style>";

                body += @"<br /><br /> المبلغ المطلوب " + sum1s.Text;

                body += @"<br /><br /> Thank You";
                mail.Body = new TextPart("html") { Text = body };

                byte[] bytes = Encoding.UTF8.GetBytes(mail.ToString());
                string raw_message = Convert.ToBase64String(bytes)
                  .Replace('+', '-')
                  .Replace('/', '_')
                  .Replace("=", "");

                UserCredential credential;
                //read your credentials file
                using (FileStream stream = new FileStream(Application.StartupPath + @"/credentials.json", FileMode.Open, FileAccess.Read))
                {
                    string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                    path = Path.Combine(path, ".credentials/gmail-dotnet-quickstart.json");
                    credential = GoogleWebAuthorizationBroker.AuthorizeAsync(GoogleClientSecrets.Load(stream).Secrets, Program.Scopes, "user", CancellationToken.None, new FileDataStore(path, true)).Result;
                }
                //call your gmail service
                var service = new GmailService(new BaseClientService.Initializer() { HttpClientInitializer = credential, ApplicationName = Program.ApplicationName });
                var msg = new Google.Apis.Gmail.v1.Data.Message();
                msg.Raw = raw_message;
                service.Users.Messages.Send(msg, "me").Execute();
                MessageBox.Show("تم ارسال التقرير بنجاح", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);

And what I receive is:

تراكمي دائن مدين البيان المرجع التاريخ

985.00 58228.00 57243.00 رصيد منقول - 01/03/2022 00:00:00 AM
985 58228 -57243 المجموع الكلي - 11/03/2022 09:49:42 AM
المبلغ المطلوب + 985 شيكل

Thank You
AnswerRe: Send a mail that has Arabic characters using Gmail API Pin
Randor 11-Mar-22 13:17
professional Randor 11-Mar-22 13:17 
QuestionGenerate Textbox on runtime Pin
Saim Ullah 20219-Mar-22 22:47
Saim Ullah 20219-Mar-22 22:47 
QuestionRe: Generate Textbox on runtime Pin
Richard MacCutchan9-Mar-22 23:38
mveRichard MacCutchan9-Mar-22 23:38 
AnswerRe: Generate Textbox on runtime Pin
Saim Ullah 202110-Mar-22 0:23
Saim Ullah 202110-Mar-22 0:23 
GeneralRe: Generate Textbox on runtime Pin
Richard MacCutchan10-Mar-22 0:31
mveRichard MacCutchan10-Mar-22 0:31 
GeneralRe: Generate Textbox on runtime Pin
Saim Ullah 202110-Mar-22 0:41
Saim Ullah 202110-Mar-22 0:41 
GeneralRe: Generate Textbox on runtime Pin
Richard MacCutchan10-Mar-22 0:45
mveRichard MacCutchan10-Mar-22 0:45 
AnswerRe: Generate Textbox on runtime Pin
OriginalGriff10-Mar-22 0:12
mveOriginalGriff10-Mar-22 0:12 
GeneralRe: Generate Textbox on runtime Pin
Saim Ullah 202110-Mar-22 0:34
Saim Ullah 202110-Mar-22 0:34 
GeneralRe: Generate Textbox on runtime Pin
OriginalGriff10-Mar-22 1:08
mveOriginalGriff10-Mar-22 1:08 
GeneralRe: Generate Textbox on runtime Pin
Saim Ullah 202110-Mar-22 7:59
Saim Ullah 202110-Mar-22 7:59 
AnswerRe: Generate Textbox on runtime Pin
RedDk10-Mar-22 8:26
RedDk10-Mar-22 8:26 
GeneralRe: Generate Textbox on runtime Pin
Richard MacCutchan10-Mar-22 22:21
mveRichard MacCutchan10-Mar-22 22:21 
GeneralRe: Generate Textbox on runtime Pin
RedDk11-Mar-22 8:06
RedDk11-Mar-22 8:06 
QuestionC# File.Create terminating WimForm app wiith no error thrown ? Pin
BillWoodruff8-Mar-22 5:03
professionalBillWoodruff8-Mar-22 5:03 
AnswerRe: C# File.Create terminating WimForm app wiith no error thrown ? Pin
Pete O'Hanlon8-Mar-22 5:24
mvePete O'Hanlon8-Mar-22 5:24 
GeneralRe: C# File.Create terminating WimForm app wiith no error thrown ? Pin
BillWoodruff8-Mar-22 6:27
professionalBillWoodruff8-Mar-22 6:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.