In my WinForm application there is some strange behavior coded in C #.
In my: Private Zero Button Save_Click (Object Sender, EventArgs e)
I am calling my function: Am I missing something or someone needs to manually trigger to trigger such an event. (I tried using Thanks in advance - Edit: Code (WorkTicketId>) // // Ticket Info Functions .updateTicketInfo (workTicketId, comboBoxPriority) If a ticket is active, then // and send email function: functions.sendStatusEmail ( ); The strange thing is that when I press the Save button, e-mail does not start, but if I close my application then the mail Is handled and sent.
client.SendAsync (mail, blank);
, it triggers on click, but mail was empty) Private Zero Button Save_Click (Object Sender, EventArgs E) {// Check. Selected indices, combo box states. Selected index, text box comment. Lesson); // feedback label gives Feedback.Text = "renewed"; // Active Ticket Update updates ActiveTicketList (); // work in the list of the ticket line. Grid Activitalyst Rao [Kamgrid Index] Selected = true; // Check to change ticket status (comboBoxStatus.SelectedIndex! = WorkTicketStatus) {// Check if contact person is present (label contact PersonValue.Text.ToString ()! = "") {// Contacting people Sends email for (LabelContactPersonValue.Text, comboBoxStatus.SelectedIndex, workTicketId, textboxDescription.Text); } // Update Working ticket status Ticket Status = comboBoxStatus.SelectedIndex; }}}
// sends a status email to contact the person // sender Email (string email, int newStatus, int ticket id, string ticket text) {// Define variable string emailSubject; String EmailBody; // Some Exclusive Mail Content Handling // Mail Mails Mail = New Mailmasses ("myFromEmail@hidden.com", Email, Email Subject, Email Body); SmtpClient Client = New SmtpClient (Configuration Manager. AppSettings ["MailSMTP"]); Mail.IsBodyHtml = True; Client.Send (mail); // settle mail. Conflict (); }
Do not understand why this will not work. I have used the function below and it successfully sends the email:
public static bund SendEmail (string smtpServer, string from adapter, string to displayname, string to address, string subject, string content , Boole important) {MailAddress from = new mailaddress (with adapter, from display name); Mail Preference Preference = Important? Mail Priority High: Mail Preference Normal; Mail message m = new mailmessage {from = to, subject = theme, body = content, priority = priority, isBodyHtml = false}; Mail address = new mail address (toAddress); M.T.O. Add (To); SmtpClient c = New SmtpClient (smtpServer) {UseDefaultCredentials = false}; C. Sand (m); Back true; }
There is no crime, but are you sure that this application is closing? The result of which email is being sent is delay between emails in most of the time and the traffic on the SMTP server Due to it it gets. Try pressing that button and then wait for some time (3-4 minutes) and try to refresh your inbox during that time.
Comments
Post a Comment