我在发送邮件时遇到问题

我在发送邮件时遇到问题

本文介绍了我在发送邮件时遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,早上好,

我阅读了您的代码,并在应用代码时显示,我收到了您的邮件不予发送"
先生,我是一名学生,我已经在www.kohlihosting.net免费注册
先生,您能告诉我一些示例,将其填写在下面的字段中吗?

good morning sir,

i read your code and when i apply it shows, i got" your mail not to be send"
sir i am a student and i freely registered in www.kohlihosting.net
sir can u tell me some example to fill it in field below

"    SmtpMail.SmtpServer = "your_server_address";    "


先生,那么我可以弄清楚我应该在这里写些什么,
我正在使用linux托管,
以下是一些详细信息:


sir then i can figure out what i should write here,
i m using linux hosting,
some detail is given below:

VistaPanel version:2.4.0 RC1
Operating systemLinux
Apache version:2.2.12 (Unix)
PHP version:5.2.10
MySQL version:5.0.84
Skin / Graphics Originally developed by CPSkins.com







using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Web.Mail;
using System.Net.Mail;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    public int sendMail(string to, string cc, string bcc, string subject, string body)
    {
        try
        {

            SmtpMail.SmtpServer = "your_server_address";
            MailMessage msg = new MailMessage();
            msg.From = "your_email_id";
            msg.To = to;
            msg.Cc = cc;
            msg.Bcc = bcc;
            msg.Subject = subject;
            msg.Body = body;
            SmtpMail.Send(msg);
            return (1);
        }
        catch
        {
            return (0);
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        String to = TextBox1.Text;
    String cc = "";
    String bcc ="";
    String subject = "";
    String body = TextBox2.Text;
    int status = sendMail(to,cc,bcc,subject,body);
    if(status == 1)
        Response.Write("your mail has been sent successfully");
    else
        Response.Write("sorry! your mail could not be sent�");
    }
}

推荐答案

amit _pathak_aadi写道:
amit _pathak_aadi wrote:

我阅读了您的代码



很可惜您没有阅读发布问题的指南.请,请将您的问题发布到文章结尾的论坛中.



What a pity you did not read the guidance on posting a question. Please, please, post your question in the forum at the end of the article.


amit _pathak_aadi写道:
amit _pathak_aadi wrote:

SmtpMail.SmtpServer =您的服务器地址";

SmtpMail.SmtpServer = "your_server_address";



作为开发人员,您确实应该能够确定该字段需要处理您的电子邮件的SMTP服务器的Internet地址(IP地址或名称).



As a developer you really sgould be able to determine that this field needs the internet address (IP address or name) of the SMTP server that handles your email.



这篇关于我在发送邮件时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 23:46