在不使用数据库的情况下以PHP/asp.net发送邮件 [英] Send Mail in PHP/asp.net without using data base

查看:66
本文介绍了在不使用数据库的情况下以PHP/asp.net发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

发送不带数据库的公司ID邮件.
单击注册表格中的提交"按钮时,可以使用公司ID发送邮件.

给我这两种语言的链接.

Send a mail in company ID without using database.
It is possible to send mail in Company ID when click on submit button in registration form.

Give me link for both language.

推荐答案

尝试此方法.使用公司的电势

try this method.Use your company cardentials

public Boolean SendingMail(string From, string To, string Subject,string Body)
	{
        try
        {
            MailMessage m = new MailMessage("Uma Shankar<umashankar@gmail.com>", To);
            m.Subject = Subject;
            m.Body = Body;
            m.IsBodyHtml = true;
            SmtpClient smtp = new SmtpClient();
            smtp.Host = "mail.google.com";
            NetworkCredential authinfo = new NetworkCredential("senderemailid", "yourpassword");
            smtp.UseDefaultCredentials = false;
            smtp.Credentials = authinfo;
            smtp.Send(m);
            return true;
        }
        catch (Exception ex)
        {
            return false;
        }
	}


vb解决方案(带备注)..

导入System.Net.Mail

''------------------------------------------------ ----------
''SendMailMessage
''------------------------------------------------ ----------
''来自String
''接收字符串
''主题字符串
''body String
''------------------------------------------------ ----------
''使用.Net Framework发送邮件.不会通知用户活动. (小心!)
''------------------------------------------------ ----------
Public Sub SendMailMessage(ByVal from As String,ByVal Recepient As String,_
ByVal主题为String,ByVal主体为String)
''实例化MailMessage的新实例
将mMailMessage设为新的MailMessage()变暗

''设置邮件的发件人地址
mMailMessage.From =新MailAddress(来自)
''设置邮件的收件人地址
mMailMessage.To.Add(新MailAddress(收件人))

''设置邮件主题
mMailMessage.Subject =主题
''设置邮件正文
mMailMessage.Body =正文

''将邮件正文的格式设置为HTML
mMailMessage.IsBodyHtml = True
''将电子邮件的优先级设置为正常
mMailMessage.Priority = MailPriority.Normal

''实例化SmtpClient的新实例
将mSmtpClient变暗为新的SmtpClient()
mSmtpClient.Host ="YOURMAILSERVER"

''发送邮件
mSmtpClient.Send(mMailMessage)
结束Sub
vb solution (with Remarks)..

Imports System.Net.Mail

''----------------------------------------------------------
'' SendMailMessage
''----------------------------------------------------------
''from String
''recepient String
''subject String
''body String
''----------------------------------------------------------
''Sends mail using .Net Framework. Will not notify user of activity. (CAREFUL!)
''----------------------------------------------------------
Public Sub SendMailMessage(ByVal from As String, ByVal recepient As String, _
ByVal subject As String, ByVal body As String)
''Instantiate a new instance of MailMessage
Dim mMailMessage As New MailMessage()

''Set the sender address of the mail message
mMailMessage.From = New MailAddress(from)
''Set the recepient address of the mail message
mMailMessage.To.Add(New MailAddress(recepient))

''Set the subject of the mail message
mMailMessage.Subject = subject
''Set the body of the mail message
mMailMessage.Body = body

''Set the format of the mail message body as HTML
mMailMessage.IsBodyHtml = True
''Set the priority of the mail message to normal
mMailMessage.Priority = MailPriority.Normal

''Instantiate a new instance of SmtpClient
Dim mSmtpClient As New SmtpClient()
mSmtpClient.Host = "YOURMAILSERVER"

''Send the mail message
mSmtpClient.Send(mMailMessage)
End Sub


这篇关于在不使用数据库的情况下以PHP/asp.net发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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