使用classemail函数在C#中发送电子邮件 [英] Sending email in C# using classemail function

查看:102
本文介绍了使用classemail函数在C#中发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public void SendMail1(string[] ToId, string Subject, string MailBody)
       {
           try
           {
               ClassEmail.classEmail objMail = new ClassEmail.classEmail();
               string fromMail = "abc@gmail.com";
              
               objMail.SendEmail(fromMail, Subject, null, MailBody, ToId);

           }
           catch (Exception ex)
           {

           }
       }







using System;
using System.Web.UI;
using System.Web.UI.HtmlControls;

namespace ClassEmail
{
    public class classEmail : Page
    {
        public classEmail();

        public string SendEmail(string EmailFrom, string EmailSubject, HtmlInputFile emailAttachment, string emailBody, params string[] EmailTo);
        public string SendEmailAttachment(string EmailFrom, string EmailSubject, Array emailAttachmentpaths, string emailBody, params string[] EmailTo);
        public string SendEmailAttachment(string EmailFrom, string EmailSubject, HtmlInputFile emailAttachment, string emailBody, params string[] EmailTo);
        public string SendEmailAttachment(string EmailFrom, string EmailSubject, string emailAttachmentpath, string emailBody, params string[] EmailTo);
        public string SendEmailAttachmentReplyTo(string EmailFrom, string EmailSubject, Array emailAttachmentpaths, string emailBody, string ReplyTo, params string[] EmailTo);
        public string SendEmailAttachmentWithCC(string EmailFrom, string EmailSubject, Array emailAttachmentpaths, string emailBody, string ccIds, params string[] EmailTo);
        public string SendEmailAttachmentWithCCBCC(string EmailFrom, string EmailSubject, Array emailAttachmentpaths, string emailBody, string ccIds, string bccIds, params string[] EmailTo);
        public string SendEmailWithReplyTo(string EmailFrom, string EmailSubject, HtmlInputFile emailAttachment, string emailBody, string ReplyTo, params string[] EmailTo);
        public string SendEmailWithReplyToWithCC(string EmailFrom, string EmailSubject, string emailAttachment, string emailBody, string ReplyTo, string ccIds, params string[] EmailTo);
        public string SendEmailWithReplyToWithCCBCC(string EmailFrom, string EmailSubject, string emailAttachment, string emailBody, string ReplyTo, string ccIds, string bccIds, params string[] EmailTo);
    }
}





我的尝试:



我正在尝试使用此功能发送电子邮件。当我点击发送按钮时,我会传递必填字段并调用上述功能。但我无法发送任何电子邮件虽然它没有给我任何错误,但邮件没有被发送。也使用smtp它工作正常但我只想使用这个功能。请帮忙!



What I have tried:

i'm trying to send an email using this function.when i click on the send button i passes the required fields and call this above function.but i'm unable to send any emails.though it does not gives me any error but mail is not getting sent.also using smtp it works fine but i want to use this function only.please help!

推荐答案

ClassEmail.classEmail();是你的东西。这不是我们可以访问的东西所以我们无法告诉你它有什么问题。



如果你有源代码然后放一个断点它并进入该调用,然后您可以调试它以找出正在发生的事情。如果您没有源代码,请与执行此操作的人联系并让他们为您提供帮助。如果你不能那样做,那就去除它并直接使用SMTP,正如你所提到的那样有效。
ClassEmail.classEmail(); is something you have. It is not something we can access so there is no way for us to tell you what is wrong with it.

If you have the source code then put a breakpoint on it and step into that call and then you can debug it to find out what is happening. If you don't have the source code contact the person who does and have them help you. If you can't do that, then get rid of that and use SMTP directly, as you have mentioned that works.


这篇关于使用classemail函数在C#中发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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