精华内容
参与话题
问答
  • Email

    千次阅读 2018-03-02 15:41:00
    C#邮件发送



       public static void SendMail(string emsg)
            {
                string host = "smtp.163.com";
                string username = "...@163.com";
                string pwd = "....";
                string formsb = "...";//接受
                string fromcc = "...";//抄送
               
    
                SmtpClient sc = new SmtpClient(host);
                sc.DeliveryMethod = SmtpDeliveryMethod.Network;
                sc.UseDefaultCredentials = true;
                sc.Credentials = new System.Net.NetworkCredential(username, pwd);
    
                string subject = "标题";
                string body = "正文";
    
                MailMessage msg = new MailMessage();
                msg.From = new MailAddress(username, "程序提醒");
                msg.To.Add(formsb);
                if (!string.IsNullOrEmpty(fromsc))
                    msg.CC.Add(fromsc); //抄送人
    
                msg.BodyEncoding = Encoding.UTF8;
                msg.Subject = subject;
                msg.Body = body;
                msg.IsBodyHtml = true;
                msg.Priority = MailPriority.High;
    
                try
                {
                    sc.Send(msg);
                    Console.WriteLine("发送成功!");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }



    展开全文
  • 检查email格式并确保email唯一

    千次阅读 2018-05-07 14:01:39
    $panelBefore.find('.email-input').on('input', function () { var $this = $(this), $subEmail = $panelBefore.find('.submit-newemail'), ...
    $panelBefore.find('.email-input').on('input', function () {
                            var $this = $(this),
                                $subEmail = $panelBefore.find('.submit-newemail'),
                                email = $.trim($this.val()),
                                pattern = /\w+([\-+.']\w+)*@\w+([\-.]\w+)*\.\w+([\-.]\w+)*/,
                                $recognised = $panelBefore.find('.recognised');
    
                            if (ajaxRegisterEmail !== undefined) {
                                ajaxRegisterEmail.abort();
                            }
    
                            if (email !== '' && pattern.test(email)) {
                                ajaxRegisterEmail = $.ajax({
                                    url: getUncachedUrl('/' + currentLanguage + '/Base/BaseHandler'),
                                    type: 'POST',
                                    data: {
                                        act: 'validate-email',
                                        email: email
                                    },
                                    success: function (data) {
                                        if (data.status === 's') {
                                            $recognised.slideDown();
                                            $subEmail.prop('disabled', true);
                                        } else {
                                            $recognised.hide();
                                            $subEmail.prop('disabled', false);
                                        }
                                    }
                                });
                            } else {
                                if (email === '') {
                                    $subEmail.prop('disabled', true);
                                } else {
                                    $subEmail.prop('disabled', false);
                                }
                                $recognised.hide();
                            }
    
                        });

    展开全文
  • I started using the email-ext plugin. I added the plugin as "post build" step to a configuration. A job was built and now I want to send an test email. Here is what I did: - Create the folder $JENKI....

    I started using the email-ext plugin. I added the plugin as "post build" step to a configuration. A job was built and now I want to send an test email. 

    Here is what I did:
    - Create the folder $JENKINS_HOME\email-templates, where JENKINS_HOME is D:\jenkins
    - Download the groovy-html.template and copy it to D:\jenkins\email-templates
    - On the "Email Template Testing"-page I inserted the filename: "groovy-html.template"

    others email template:

    https://github.com/jenkinsci/email-ext-plugin/tree/master/src/main/resources/hudson/plugins/emailext/templates
     

    展开全文
  • python email 模块

    千次阅读 2019-07-02 19:37:18
    参考简书,廖雪峰python import smtplib ...from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart import traceback import time def send(self,content=None): ''''...

    参考简书廖雪峰python

    import smtplib
    import os
    from email.mime.text import MIMEText
    from email.mime.multipart import MIMEMultipart
    import traceback
    import time   
     def send(self,content=None):
            '''''
            发送邮件
            '''
            server = None
            index = 1  #邮件重试
            while index < 3:
                index += 1
                try:
                    server = smtplib.SMTP_SSL("smtp.exmail.qq.com",port=465)
                    server.login(self.user,self.passwd)
                    server.sendmail("<%s>" % self.user, self.to_list + self.cc_list, self.get_attach(content=content))
                    server.close()
                    print("send email successful")
                    break
                except Exception as e:
                    traceback.print_exc()
                    time.sleep(5)
                    print("send email failed")
                finally:
                    try:
                        if server is not None:
                            server.close()
                    except Exception as e:
                        traceback.print_exc()
    
        def get_attach(self,content=None,subtype='html'):
            '''''
            构造邮件内容
            '''
            attach = MIMEMultipart()
            #添加邮件内容
            txt = MIMEText(content, _subtype=subtype, _charset='utf-8')
            attach.attach(txt)
            if self.subject is not None:
                #主题,最上面的一行
                attach["Subject"] = self.subject
            if self.user is not None:
                #显示在发件人
                attach["From"] = "Data Team<%s>" % self.user
            if self.to_list:
    
                attach["To"] = ";".join(self.to_list)#收件人列表
            if self.cc_list:
                attach["Cc"] = ";".join(self.cc_list)#抄送列表
            if self.doc:
                #估计任何文件都可以用base64,比如rar等
                #文件名汉字用gbk编码代替
                name = os.path.basename(self.doc).encode("gbk")
                f = open(self.doc,"rb")
                doc = MIMEText(f.read(), "base64", "gb2312")
                doc["Content-Type"] = 'application/octet-stream'
                doc["Content-Disposition"] = 'attachment; filename="' + name +'"'
                attach.attach(doc)
                f.close()
            return attach.as_string()
    
    
        def get_jobs_descript(self):
            """
            获取任务的执行str
            :return:
            """
            html ='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
            html += '<html xmlns="http://www.w3.org/1999/xhtml">'
            html += '<head>'
            html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'
            html += '<title>调度报告</title>'
            html += '<meta name="viewport" content="width=device-width, initial-scale=1.0"/>'
            html +='</head>'
            html +='<body>'
            till = str(datetime.datetime.now() - self.start_time)
            till = till[0:till.index(".")] #精确到秒级小数点,然后要自己弄好,
            html +='<p>启动时间:[' + self.start_time.strftime("%Y-%m-%d %H:%M:%S") +']    结束时间:[' + self.get_end_time_str() +']    持续时间:'+till+'</p>'
            ss = 0
            er = 0
            skip = 0
            run_c = 0
            pl = ''
            for job_name in self.job_run_:
                node = self.dag_job.get_node(job_name=job_name)
                if node.status == 1:
                    if node.is_active == False:
                        skip += 1
                    else:
                        ss += 1
                elif node.status == -1:
                    er += 1
                elif node.status == 0:
                    run_c += 1
                pl += node.get_job_mail_str()
            html +="<h2>统计 [成功:" + str(ss) +'\t错误:' + str(er)+'\t跳过:'+str(skip)+'\t未执行:' + str(self.job_size - ss - er - skip)+'] 总任务数: ' + str(self.job_size)+'<h2>'
            html +='<h1>邮件发送时间:' + str(datetime.datetime.now().strftime('%Y-%m-%d %H:%M')) +'</h1>'
            html += '<h1>调度报告</h1>'
            html +='<table border="1" cellpadding="0" cellspacing="0">'
            html +='<thead bgcolor="#A9A9A9"  style="color:#000000; text-align:left; font-size:14px; font-weight:bold; margin-left:220px;text-align:center">'
            html +='<tr>'
            html +='<th>状态</th>'
            html +='<th>任务名</th>'
            html +='<th>创建时间</th>'
            html +='<th>结束时间</th>'
            html +='<th>持续时间</th>'
            html +='<th>重试次数</th>'
            html +='<th>重试上限</th>'
            html +='<th>是否跳过</th>'
            html +='<th>一定正确</th>'
            html +='<th>优先级</th>'
            html +='</tr>'
            html +='</thead>'
            html +='<tbody>'
            html += pl
            html +='</tbody></table></body></html>'
            return html
    
        def get_job_mail_str(self):
            """
            获取发送邮件的行数
            :return:
            """
            sz = "<tr>"
            if self.start_time is None:
                sz += "<td>SKIP</td><td>" + self.name +'</td><td></td><td></td><td></td></tr>'
            else:
                if self.status == 1:
                    sz += "<td><font color=\"blue\">SUCCEED</font></td><td>" + self.name+'</td>'
                elif self.status ==-1:
                    sz += "<td><font color=\"red\">ERROR</font></td><td>" + self.name+'</td>'
                elif self.status ==0:
                    sz += "<td><font color=\"green\">RUNNING</font></td><td>" + self.name+'</td>'
                elif self.status is None:
                    sz += "<td><font color=\"black\">NOT_RUN</font></td><td>" + self.name+'</td>'
                if self.start_time is not None:
                    sz +='<td>' + self.start_time.strftime('%Y-%m-%d %H:%M:%S')+'</td>'
                else:
                    sz +='<td></td>'
                if self.end_time is not None:
                    sz +='<td>'+self.end_time.strftime('%Y-%m-%d %H:%M:%S') +'</td>'
                else:
                    sz +='<td></td>'
                if self.start_time is None or self.end_time is None:
                    sz +='<td></td>'
                else:
                    plz = str(self.end_time - self.start_time)
                    if plz.index(':') == 1:
                        sz += '<td>0' + str(self.end_time - self.start_time)[0:7] +'</td>'
                    else:
                        sz += '<td>' + str(self.end_time - self.start_time)[0:8] +'</td>'
                sz += '<td>' + str(self.retry_time) + '</td>'
                sz += '<td>' + str(self.retry_limit) + '</td>'
                if self.is_active:
                    sz +='<td></td>'
                else:
                    sz += '<td><font color=\"red\">' + str(self.is_active == False) +'</font></td>'
                if self.forver_right:
                    sz += '<td><font color=\"red\">' + str(self.forver_right == True) +'</font></td>'
                else:
                    sz += '<td></td>'
                sz += '<td>' + str(self.priority) +'</td>'
            sz += '</tr>'
            return sz
    

     

    展开全文
  • Spring 发送Email

    千次阅读 2019-08-25 16:56:34
    Spring Email抽象的核心是MailSender接口。顾名思义,MailSender的实现能够通过连接Email服务器实现邮件发送的功能,如图所示: Spring自带了一个MailSender的实现也就是JavaMailSenderImpl,它会使用JavaMail API...
  • Java Email

    万次阅读 2013-09-27 15:50:01
    1.简单电子邮件例子之二: ...Email email = new SimpleEmail(); email.setHostName("smtp.qq.com");//qq email.setSmtpPort(465);//iport email.setAuthenticator(new DefaultAuthenticator("fromUser
  • HTML Email 模板示例

    万次阅读 2017-09-14 23:27:38
    HTML Email
  • Yahoo Email VS 163 Email

    千次阅读 2012-08-14 21:17:14
    Yahoo Email里太多了垃圾邮件,也不知道是yahoo不愿意过滤呢,还是技术上不行呢,什么Yahoo12条,估计背后有其他缘由。 163 感觉 功能太多,让我一下都不知道怎样,总体省去了我每天删除大量的垃圾邮件,赞一下
  • SpringBoot整合Email 邮件发送

    千次阅读 2020-03-14 21:50:08
    在开发中,经常会碰到email邮件发送的场景 如发送验证码,向客户发送邮件等等。 今天,本项目将讲解通过Springboot 发送email 邮件 普通文本邮件 ,HTML内容板式邮件 ,包含静态资源邮件,以及带附件邮件。
  • Email模块(1)-图库分享无Email

    千次阅读 2016-10-18 19:35:19
    解决方法此为Android5.0 Email的新design,在没有登入任何account时,不能使用email分享。请参考AccountReconciler类中reconcileAccountsInternal()方法
  • 1.search_email_collector2.use auxiliary/gather/search_email_collector 3.set domain altoromutual.com 4.run
  • Jenkis邮件通知:Email Extension Plugin

    千次阅读 2018-06-06 09:04:37
    Email Extension Plugin
  • commons-email-1.2.jar/email.jar/activation.jar

    千次下载 热门讨论 2012-05-07 11:53:22
    用commons-email-1.2.jar 发送邮件的三个jar 文件
  • git config --global user.email “你的邮箱” 查看配置 git config --list 修改你的用户名和邮箱 git config --global --replace-all user.name “你的用户名” git config --global --replac...
  • 常用正则表达式—邮箱(Email

    万次阅读 多人点赞 2016-06-14 17:48:05
    常用正则表达式—邮箱(Email)本文针对有一点正则基础的同学,如果你对正则一无所知,请移步“正则表达式30分钟入门教程”学习。要验证一个字符串是否为邮箱的话,首先要了解邮箱账号的格式。我尝试过在网上找出一...
  • logstash output email

    千次阅读 2018-06-14 14:13:28
    email { to =&gt; "xxxxxx@163.com" from =&gt; "xxxxxxx" username =&gt; "xxxxx" password =&gt; "xxxxxxxx" address =&gt; "smtp....
  • Email工具类

    千次阅读 2018-05-21 13:36:24
    本列是在SpringBoot的基础上建立的,有些...依赖的jar包:org.apache.commons:commons-lang3:3.4 org.apache.commons:commons-email:1.4 org.slf4j:slf4j-api:1.7.24 @Component public class MailUtil { private...
  • function isValidEmailAddress(emailAddress) { var pattern = /^([a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(\.[a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\u
  • MTK email

    千次阅读 2011-03-16 21:09:00
      Email 主要compile option 如下: EMAIL_SUPPORT = ALL SSL 主要compile option 如下: SSL_SUPPORT SOCKET_SSL_SUPPORT SECLIB_SUPPORT   打开Email 功能的同时...
  • 计算机网络 Email应用

    万次阅读 2018-11-25 13:15:53
    email消息只能包含7为ASCII码 使用持久性连接 使用回车换行(CRLF).CRLF确认消息的结束   与http对比 http 拉式 smtp 推式 使用命令/响应格式 命令与状态代码都是ASCII码 http 每个对象...
  • import email.utils ModuleNotFoundError: No module named ‘email.utils’; ‘email’ is not a package 最基本的就是安装这个模块,但是email是python自带的 后来网上查了原因 先确保你的当前文件夹中不要有...
  • 一开始将文件名命名为email.py,运行的时候报错ModuleNotFoundError: No module named 'email.mime'; 'email' is not a package,将文件名改成emailUtil.py(或其他)就可以了。主要是因为和Python内置的ema...
  • Python 发送 email 的三种方式

    千次阅读 2018-10-18 08:44:27
    Python发送email的三种方式,分别为使用登录邮件服务器、使用smtp服务、调用sendmail命令来发送三种方法 原文请参见米扑博客:Python 发送 email 的三种方式 Python发送email比较简单,可以通过登录邮件服务来发送...
  • Email Header 是什么

    万次阅读 2016-06-26 21:47:55
    Email Header 是什么-What is an Email Header 每天都收邮件,你是否注意到一个名词:Email Header。那这个东西究竟是什么,对我们有什么意义呢。 What is an Email Header  请参考链接地址:...
  • C# Email发送邮件

    千次阅读 2018-07-23 17:38:23
    本文实例为大家分享了C# Email发送邮件的具体代码,供大家参考,具体内容如下 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing...
  • pip install email 报错解决办法

    千次阅读 2020-03-27 21:19:14
    运行一段发送邮件的python代码时,报如下错误: ImportError:Nomodule named'email.mime';emailisnota package 执行:pip install email ,报错 执行:easy_install email,OK
  • @Valid + @Email 示例

    2019-06-12 10:53:31
    @PostMapping("/dada") public Object getEmail(@RequestBody @Valid AEmail aemail) { System.out.println("aemail:" + aemail.email); return "fff"; } public static clas...
  • Java正则表达式email

    千次阅读 2018-12-14 20:22:29
    学习Java中正则表达式-验证email邮箱 public static void main(String[] args) { // 要验证的字符串 String str = "service@xsoftl...

空空如也

1 2 3 4 5 ... 20
收藏数 183,363
精华内容 73,345
关键字:

email