Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Str+=”; Str+=”; Str+=“”+s2+“”; Str+=”; Str+=”; Str+=”; Str+=”; mail.Subject=textBox4.Text; mail.Body=Str; 所以在textBox6中,你有换行符,当你发送电子邮件时,换行符被空格替换,我理解对了吗?在代码中,你发送的是textBox6的内容-因此,在不知道你在放什么的情况下,很难看到应该放什么。如果发送HTML格式的邮件,您需要使用_C#_Email - Fatal编程技术网

C# Str+=”; Str+=”; Str+=“”+s2+“”; Str+=”; Str+=”; Str+=”; Str+=”; mail.Subject=textBox4.Text; mail.Body=Str; 所以在textBox6中,你有换行符,当你发送电子邮件时,换行符被空格替换,我理解对了吗?在代码中,你发送的是textBox6的内容-因此,在不知道你在放什么的情况下,很难看到应该放什么。如果发送HTML格式的邮件,您需要使用

C# Str+=”; Str+=”; Str+=“”+s2+“”; Str+=”; Str+=”; Str+=”; Str+=”; mail.Subject=textBox4.Text; mail.Body=Str; 所以在textBox6中,你有换行符,当你发送电子邮件时,换行符被空格替换,我理解对了吗?在代码中,你发送的是textBox6的内容-因此,在不知道你在放什么的情况下,很难看到应该放什么。如果发送HTML格式的邮件,您需要使用,c#,email,C#,Email,和您可能不在乎,但现在每个人都可以看到您邮件服务器的密码…Ya Murph您是对的,但我如何发送数据。我是否需要使用某种循环来发送数据。但最终我们需要使用smtp.mail(mail)一次性发送消息,因此在textBox6中,您有换行符,当您发送电子邮件时,换行符将替换为空格,我理解得对吗?在那段代码中,你发送的是textBox6的内容——因此,在不知道你在输入什么的情况下,很难看到应该输出什么。如果发送HTML格式的邮件,您需要使用和您可能不在乎,但现在每个人都可以看到您邮件服务器的密码…Ya


您可能不在乎,但现在每个人都可以看到您邮件服务器的密码…Ya Murph您是对的,但我如何发送数据。我是否需要使用某种循环来发送数据。但最终我们需要使用smtp.mail(mail)一次性发送消息,因此在textBox6中,您有换行符,当您发送电子邮件时,换行符将替换为空格,我理解得对吗?在那段代码中,你发送的是textBox6的内容——因此,在不知道你在输入什么的情况下,很难看到应该输出什么。如果发送HTML格式的邮件,您需要使用


您可能不在乎,但现在每个人都可以看到您邮件服务器的密码…Ya Murph您是对的,但我如何发送数据。我是否需要使用某种循环来发送数据。但最终我们需要使用smtp一次性发送邮件。邮件(mail)不,我不使用Outlook。但是我会尝试替换选项不,我不使用Outlook。但是我会尝试替换选项你好,谢谢你的帖子。但这是行不通的。我认为逻辑上没有错误。嗨,当我写文本时,这个概念起作用了。替换(“\r\n”,“
”)嗨,谢谢你的帖子。但这是行不通的。我认为逻辑上没有错误。嗨,当我做文本时,这个概念起作用了。替换(“\r\n”,“
”)
            MySqlCommand cmdsd;
            MySqlConnection conn;
            string s23 = "";
            conn = new MySqlConnection("server=localhost;database=projecttt;uid=root;password=techsoft");
            conn.Open();

             //smtp which will be loaded is webmail.techsofttechnologies.com
            cmdsd = new MySqlCommand("select smtp from smtp", conn);
            MySqlDataReader dr45 = cmdsd.ExecuteReader();

            while (dr45.Read())
            {
                s23 = dr45.GetString(0).Trim();
            }
            string s1 = textBox3.Text;
            string s4 = textBox1.Text;
            string S5 = textBox2.Text;
            string attachment = textBox5.Text;
            MailMessage mail = new MailMessage();
            mail.From = new MailAddress(s4, S5);
            mail.BodyEncoding = Encoding.UTF8;                
            mail.To.Add(s1);
            mail.Subject = textBox4.Text;
            mail.Body = "<body>"+textBox6.Text+"</body>";                
            //mail.Body = textBox6.AppendText("\n");

            AlternateView planview = AlternateView.CreateAlternateViewFromString("This is my plain text content, viewable tby those clients that don't support html");
            AlternateView htmlview = AlternateView.CreateAlternateViewFromString("<b>This is bold text and viewable by those mail clients that support html<b>");
            mail.IsBodyHtml = true;
            mail.Priority = MailPriority.High;
            System.Net.Mail.Attachment jil = new System.Net.Mail.Attachment(attachment);
            mail.Attachments.Add(jil);
            SmtpClient smtp = new SmtpClient(s23);
            try
            {
                smtp.Send(mail);
            }

            catch (Exception ex)
            {
                Exception exc = ex;
                string Message = string.Empty;
                while (exc != null)
                {
                    Message += exc.ToString();
                    exc = exc.InnerException;
                }
            }
            conn.Close();
            this.Close();
        }
        catch (Exception err)
        {
            MessageBox.Show(err.Message);
        }

    }
text.Replace("\n", "<br/>")
            //The text will be loaded here
            string s2= textBox6.Text;     

            //All blank spaces would be replaced for html subsitute of blank space(&nbsp;) 
            s2 = s2.Replace(" ", "&nbsp;");          

            //Carriage return & newline replaced to <br/>
            s2=s2.Replace("\r\n", "<br/>");                
            string Str = "<html>";
            Str += "<head>";
            Str += "<title></title>";
            Str += "</head>";
            Str += "<body>";
            Str += "<table border=0 width=95% cellpadding=0 cellspacing=0>";
            Str += "<tr>";
            Str += "<td>" + s2 + "</td>";
            Str += "</tr>";
            Str += "</table>";
            Str += "</body>";
            Str += "</html>";                        
            mail.Subject = textBox4.Text;                          
            mail.Body = Str;