C#.net代码(当我通过互联网连接时如何从他的窗口项目发送短信) [英] C# .net Code( How to send sms from his window project when i am connected via internet)

查看:102
本文介绍了C#.net代码(当我通过互联网连接时如何从他的窗口项目发送短信)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C#.net代码(当我通过互联网连接 bia 时如何从他的窗口项目发送短信)
我的邮件ID:-

C# .net Code( How to send sms from his window project when i am connected bia via internet)
my mail id :-

推荐答案

Google是您的朋友:很好,经常拜访他.与在这里发布问题相比,他可以更快地回答问题.

快速搜索获得了超过450万次点击.
https://www. google.co.uk/search?sourceid=chrome&ie=UTF-8&q=send+sms+via+internet+c%23 [
Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...

A very quick search gave over 4.5 million hits.
https://www.google.co.uk/search?sourceid=chrome&ie=UTF-8&q=send+sms+via+internet+c%23[^]

In future, please try to do at least basic research yourself, and not waste your time or ours.


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net.Mail;


namespace WindowsApplication1
{
    public partial class Form1 : Form
{

public Form1()
{
    InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
try
{
    MailMessage mail = new MailMessage();
    SmtpClient SmtpServer = new SmtpClient(
    "smtp.gmail.com");
    mail.From = new MailAddress("kamacac87@gmail.com");
    mail.To.Add("cac.kamaraju@gmail.com");
    mail.Subject = "Test Mail";
    mail.IsBodyHtml = true;
    string htmlBody;
    htmlBody = "Hello P.Kamaraju<br>      Write some HTML code here";
    mail.Body = htmlBody;
    SmtpServer.Port = 587;
    SmtpServer.Credentials = new
    System.Net.NetworkCredential("kamacac87", "yakubhai");
    SmtpServer.EnableSsl = true;
    SmtpServer.Send(mail);
    MessageBox.Show("Mail has been sent Successfully.");
}
catch (Exception ex)
{
    MessageBox.Show(ex.ToString());
}
}
}
}




希望对您有帮助.




I hope it helps you.


这篇关于C#.net代码(当我通过互联网连接时如何从他的窗口项目发送短信)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆