fork(1) download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. public static void SendMail(string smtpServer, string from , string password,
  8. string mailto, string caption, string message, string attachFile = null)
  9. {
  10. try
  11. {
  12. MailMessage mail = new MailMessage();
  13. mail.From = new MailAddress(from);
  14. mail.To.Add(new MailAddress(mailto));
  15. mail.Subject = caption;
  16. mail.Body = message;
  17. if (!string.IsNullOrEmpty(attachFile))
  18. mail.Attachments.Add(new Attachment(attachFile));
  19. SmtpClient client = new SmtpClient();
  20. client.Host = smtpServer;
  21. client.Port = 587;
  22. client.EnableSsl = true;
  23. client.Credentials = new NetworkCredential(from.Split('@')[0], password);
  24. client.DeliveryMethod = SmtpDeliveryMethod.Network;
  25. client.Send(mail);
  26. mail.Dispose();
  27. }
  28. catch (Exception e)
  29. {
  30. throw new Exception("Mail.Send: " + e.Message);
  31. }
  32. }
  33. }
  34. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(7,2): error CS1525: Unexpected symbol `public'
prog.cs(7,17): error CS1547: Keyword `void' cannot be used in this context
prog.cs(7,29): error CS1525: Unexpected symbol `('
prog.cs(7,49): error CS1525: Unexpected symbol `string'
prog.cs(7,63): error CS1525: Unexpected symbol `string'
prog.cs(8,0): error CS1525: Unexpected symbol `string'
prog.cs(8,15): error CS1525: Unexpected symbol `string'
prog.cs(8,31): error CS1525: Unexpected symbol `string'
prog.cs(8,47): error CS1525: Unexpected symbol `string'
prog.cs(28,5): error CS1519: Unexpected symbol `catch' in class, struct, or interface member declaration
prog.cs(28,19): error CS1519: Unexpected symbol `)' in class, struct, or interface member declaration
prog.cs(29,1): error CS9010: Primary constructor body is not allowed
prog.cs(33,1): error CS1525: Unexpected symbol `}'
Compilation failed: 13 error(s), 0 warnings
stdout
Standard output is empty