如何编写“将消息发送到手机号码以及如何将邮件发送到电子邮件地址";在.net Web应用程序中 [英] how to write "Sending messages to a mobile number and how to send a mail to the email address" in web application in .net

查看:85
本文介绍了如何编写“将消息发送到手机号码以及如何将邮件发送到电子邮件地址";在.net Web应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请告诉我答案
并且必须同时存储这些消息和邮件的已发送项目

首选语言C#代码和后端MS SQL 2008(VS 2010)

Plz tell me the answer
and having the sent items of these messages and mails must be stored also

the preferred language C# code and back end MS SQL 2008(VS 2010)

推荐答案



检查此链接以将邮件发送到电子邮件ID

http://www.codeproject.com/KB/aspnet/EmailApplication.aspx

还有

http://www.codeproject.com/KB/aspnet/EasySMTP_package.aspx

而且您必须将SMS发送到手机.然后,您要购买该服务表格

服务提供商,例如 http://www.groupsmsindia.com/ [
Hi,

check this link for sending mail to email ids

http://www.codeproject.com/KB/aspnet/EmailApplication.aspx

And

http://www.codeproject.com/KB/aspnet/EasySMTP_package.aspx

And you''ve to send SMS to mobiles.then you want to buy that service form

service providers like http://www.groupsmsindia.com/[^]

there are so many services in market for sending sms

And you can save in your database while sending mails or sms

All the Best


要发送电子邮件代码,请参考此链接

如何通过asp.net发送电子邮件 [ ^ ]

发送短信,您需要网关api.
to send email code refer this link

How to send email through asp.net[^]

to send sms you need gateway api.


发送电子邮件

To send email

public int SendUserMail(string fromad, string toad, string body, string header, string subjectcontent)
    {
        int result = 0;
        MailMessage usermail = Mailbodplain(fromad, toad, body, header, subjectcontent);
        SmtpClient client = new SmtpClient();
        //Add the Creddentials- use your own email id and password
        client.Credentials = new System.Net.NetworkCredential("abc@gmail.com", "password"); ;
                client.Host = "smtp.gmail.com";
        client.Port = 587;
        client.EnableSsl = true; 
        try
        {
            client.Send(usermail);
            result = 1;
        }
        catch (Exception ex)
        {
            result = 0;
        } // end try 

        return result;

    }







public MailMessage Mailbodplain(string fromad, string toad, string body, string header, string subjectcontent)
   {
       System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
       try
       {
           string from = fromad;
           string to = toad;
           mail.To.Add(to);
           mail.From = new MailAddress(from, header, System.Text.Encoding.UTF8);
           mail.Subject = subjectcontent;
           mail.SubjectEncoding = System.Text.Encoding.UTF8;
           mail.Body = body;
           mail.BodyEncoding = System.Text.Encoding.UTF8;
           mail.IsBodyHtml = true;
           mail.Priority = MailPriority.High;
       }
       catch (Exception ex)
       {
           throw;
       }
       return mail;
   }


要发送短信,您需要遵循短信网关方法


To send sms you need follow sms gate way API


这篇关于如何编写“将消息发送到手机号码以及如何将邮件发送到电子邮件地址";在.net Web应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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