Exemplo n.º 1
0
    public static void sendEmailNoAttachment(String bankCode, String name, string email, string Subject, string Message)
    {
        Email        mail = new InterConnect.MailApi.Email();
        EmailAddress addr = new EmailAddress();

        addr.Address     = email;
        addr.Name        = name;
        addr.AddressType = EmailAddressType.To;

        EmailAddress[] addresses = { addr };
        mail.MailAddresses = addresses;
        mail.From          = bankCode;
        mail.Message       = Message;
        mail.Subject       = Subject;


        Messenger mapi = new Messenger();

        System.Net.ServicePointManager.ServerCertificateValidationCallback = RemoteCertificateValidation;
        Result result = mapi.PostEmail(mail);
    }
Exemplo n.º 2
0
    public Result sendMail(string mail, string pdfFile)
    {
        Result result = new Result();

        try
        {
            //http://192.168.23.15:5099/MailApi/Messenger.asmx?WSDL
            InterConnect.MailApi.Messenger  mailApi    = new InterConnect.MailApi.Messenger();
            InterConnect.MailApi.Email      email      = new InterConnect.MailApi.Email();
            InterConnect.MailApi.Attachment attachment = new InterConnect.MailApi.Attachment();
            email.From    = "*****@*****.**";
            email.Subject = "CUSTOMER RECEIPT";
            email.Message = "Customer Receipt uptil " + DateTime.Now.ToString();
            InterConnect.MailApi.EmailAddress address = new InterConnect.MailApi.EmailAddress();
            address.Address           = mail;
            address.AddressType       = InterConnect.MailApi.EmailAddressType.To;
            address.Name              = mail;
            attachment.AttachmentName = pdfFile;
            attachment.MimeType       = "application/pdf";
            //attachment.ByteArray = FileStream();


            email.MailAddresses = new InterConnect.MailApi.EmailAddress[] { address };
            email.Attachments   = new InterConnect.MailApi.Attachment[] { attachment };
            InterConnect.MailApi.Result resp = mailApi.PostEmail(email);
            string script = "<script>alert('Mail Sent Successfully')</script>";
            ClientScript.RegisterStartupScript(this.GetType(), "mailSent", script);
            result.StatusCode = resp.StatusCode;
            result.StatusDesc = resp.StatusDesc;
        }
        catch (Exception ex)
        {
            result.StatusCode = Globals.FAILURE_STATUS_CODE;
            result.StatusDesc = "EXCEPTION: " + ex.Message;
        }
        return(result);
    }