如何发送自动生成的电子邮件 [英] how to send auto generated email

查看:125
本文介绍了如何发送自动生成的电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有三个文本框的查询表单,如txtname,txtemail,txtquery。因此,当客户提交查询表单时,我希望以电子邮件的形式结束电子邮件(在txtemail中)。请帮帮我。

I have query form with three textboxes like txtname, txtemail, txtquery. so i want to end email with my signature to that email(in txtemail) when client submit the query form. please help me.

推荐答案

Asp DotNet发送邮件 [ ^ ]

DotNet Spider [ ^ ]

这些链接将显示您发送电子邮件。

要附加您的签名,您需要附加签名(html)到电子邮件正文。

这些链接肯定可以帮到你。
Asp DotNet Sending Mails[^]
DotNet Spider[^]
These links will show you to send the email.
To append your signature, you need to append the signature(html) to the email body.
These links should surely help you out.


试试这个..



Try This..

protected void SendMail()
{
    // Gmail Address from where you send the mail
    var fromAddress = "Gmail@gmail.com";
    // any address where the email will be sending
    var toAddress = YourEmail.Text.ToString();
    //Password of your gmail address
    const string fromPassword = "Password";
     // Passing the values and make a email formate to display
    string subject = YourSubject.Text.ToString();
    string body = "From: " + YourName.Text + "\n";
    body += "Email: " + YourEmail.Text + "\n";
    body += "Subject: " + YourSubject.Text + "\n";
    body += "Question: \n" + Comments.Text + "\n";
    // smtp settings
    var smtp = new System.Net.Mail.SmtpClient();
    {
        smtp.Host = "smtp.gmail.com";
        smtp.Port = 587;
        smtp.EnableSsl = true;
        smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
        smtp.Credentials = new NetworkCredential(fromAddress, fromPassword);
        smtp.Timeout = 20000;
    }
    // Passing values to smtp object
    smtp.Send(fromAddress, toAddress, subject, body);
}

protected void Button1_Click(object sender, EventArgs e)
{
    try
    {
        //here on button click what will done
        SendMail();
        DisplayMessage.Text = "Your Comments after sending the mail";
        DisplayMessage.Visible = true;
        YourSubject.Text = "";
        YourEmail.Text = "";
        YourName.Text = "";
        Comments.Text = "";
    }
    catch (Exception) { }
}


这篇关于如何发送自动生成的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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