Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
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)
           {

           }
       }


C#
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);
    }
}


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!
Posted
Updated 14-Sep-16 2:12am
v2
Comments
F-ES Sitecore 14-Sep-16 6:23am    
You'd have to post the code of ClassEmail, we can't tell from that snippet what the problem might be.
OriginalGriff 14-Sep-16 6:23am    
We can't help based on that: there just isn't any "real" information there.
We'd need to see the SendEmail function, know what the parameter values you pass are, and so on.
[no name] 14-Sep-16 6:59am    
Ask where ever you got this code from.
Vjay Y 14-Sep-16 7:12am    
could you please go in more detail about your code
Member 10549697 14-Sep-16 8:01am    
Yes sure.

1 solution

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.
 
Share this answer
 
Comments
Member 10549697 14-Sep-16 8:27am    
okay sir i will try to debug it

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900