Exemplo n.º 1
0
        public void SendText(bool includeSiteNameInSubject)
        {
            MailManager mMgr  = new MailManager();
            MailAddress _from = new MailAddress(this.From, this.FromName == null ? this.From : this.FromName);

            mMgr.SendMail(_from, this.ToList, this.CCList, this.BCCList, this.Subject, includeSiteNameInSubject, this.Body, "", new ArrayList());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Send Email As Attachement File
        /// </summary>
        /// <param name="str">Value added to the file name; Default: DateTime in seconds</param>
        public void SendAsAttachement(string str, string FormLink)
        {
            MailManager mMgr = new MailManager();

            string folder = WebContext.Server.MapPath("~/temp");

            if (!Directory.Exists(folder))
            {
                Directory.CreateDirectory(folder);
            }

            string       tempFile = WebContext.Server.MapPath("~/temp/" + StringUtils.ToURL(this.Email + "-" + str) + ".htm");
            StreamWriter sr       = new StreamWriter(tempFile);

            sr.Write(MailManager.LoadData(this.BodyFile, this.Data));
            sr.Close();
            sr.Dispose();
            sr = null;

            _attachements.Add(tempFile);

            MailAddress _from = new MailAddress(this.From, this.FromName == null ? this.From : this.FromName);

            if (string.IsNullOrEmpty(FormLink))
            {
                mMgr.SendMail(_from, this.ToList, this.CCList, this.BCCList, this.Subject, true, "Please download the attachment.", "", _attachements);
            }
            else
            {
                string _link = string.Format("Please download the attachment.<br /><p><a href=\"{0}\">Click here</a> to manage this form</p>", FormLink);
                mMgr.SendMail(_from, this.ToList, this.CCList, this.BCCList, this.Subject, true, _link, "", _attachements);
            }
            for (int i = 0; i < _attachements.Count; i++)
            {
                try
                {
                    File.Delete(_attachements[i].ToString());
                }
                catch (Exception Ex)
                {
                    ErrorContext.Add("attachment-delete", "Could not delete attachment: " + _attachements[i].ToString() + "<BR>" + Ex.Message);
                }
            }
            this._attachements.Clear();
        }
Exemplo n.º 3
0
        public void Send(bool KeepAttachementsOnServer)
        {
            MailManager mMgr = new MailManager();

            if (String.IsNullOrWhiteSpace(Body))
            {
                Body = MailManager.LoadData(this.BodyFile, this.Data);
            }
            mMgr.SendMail(
                new MailAddress(this.From, this.FromName == null? this.From: this.FromName),
                this.ToList,
                this.CCList,
                this.BCCList,
                this.Subject,
                IncludeSiteNameInSubject,
                Body,
                StringUtils.StripOutHtmlTags(Body),
                this.Attachements);

            if (DeleteAttachementsAfterSend)
            {
                DeleteAttachements();
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Sends the email in text format
        /// </summary>
        public void SendText()
        {
            MailManager mMgr = new MailManager();

            mMgr.SendMail(this.From, this.ToList, this.Subject, this.Body);
        }