标签: sendmail

在Django中使用send_mail:无法在函数的发票中显示数据

另一个Django send_mail问题.似乎我在电子邮件中显示数据时遇到问题,这些数据将表单与功能分开.似乎这是一个可变的问题.

编辑:我设法让客户名出现!现在如何用发票来做同样的事情.假设我想显示日期,invoice_no,work_orders和contract_info?

    #models.py
    class Invoice(models.Model):
    client = models.ForeignKey(Client)
    date = models.DateField()
    invoice_no = models.CharField(max_length=16)
    work_orders = models.ManyToManyField(Work_Order)
    contract_info = models.ForeignKey(Contract_Info)

    def __unicode__(self):
                return self.invoice_no

    #views.py
    @login_required
    def invoice_mail(request, id=1):
        invoices_list = Invoice.objects.filter(pk=id)
        client = invoices_list[0].client
        t = loader.get_template('registration/email.txt')
        c = Context({
        'client': client.company,
        })
        send_mail('Welcome to My Project', t.render(c), 'jess@example.com', ['mark@example.com'], fail_silently=False)
        return render_to_response('email.html', locals(), context_instance=RequestContext(request))
Run Code Online (Sandbox Code Playgroud)

这是我的email.txt

Dear {{client}},
Run Code Online (Sandbox Code Playgroud)

当我将它发送到我的电子邮件帐户时,我会收到此信息

亲爱的Currys,

django sendmail django-models django-views

2
推荐指数
1
解决办法
171
查看次数

使用Perl发送电子邮件时未安装sendmail且没有任何邮件模块

我正在建立一个露营网站,我需要发送一封来自Perl的电子邮件.但是,sendmail未安装在服务器上,这些是唯一安装的Perl模块:

  • 类::访问器
  • 配置::微小
  • 数学::计算器::单位
  • Nagios的::插件
  • PARAMS ::验证
  • Perl 5.8.8
  • TIMEDATE

还有办法从Perl脚本发送电子邮件吗?


我已经打电话给网站主办公司,但似乎他们甚至都不知道Perl是什么.更别说了sendmail.这称自己是一家虚拟主机公司.

email perl sendmail send

2
推荐指数
2
解决办法
2170
查看次数

Perl - Mail :: Sendmail编码问题

我正在尝试发送带有一些非ascii字符的消息,例如ΓÇô

Mail :: Sendmail失败并显示错误"C:/Perl64/site/lib/Mail/Sendmail.pm第237行的子例程条目中的宽字符"

有任何想法吗?

email perl encoding ascii sendmail

2
推荐指数
1
解决办法
1061
查看次数

Yandex smtp 设置与 ssl

我可以通过enableSsl="false" 和25 端口发送电子邮件。但如果有自己的域,这还不够。

此设置有什么问题或缺失?

<system.net>
    <mailSettings>
      <smtp  deliveryMethod="Network" from="Name">
        <network  host="smtp.yandex.ru" port= "465 " enableSsl="true" userName="noreply@domain.com" password="***" />
      </smtp>
    </mailSettings>
  </system.net>
Run Code Online (Sandbox Code Playgroud)

email smtp sendmail web-config

2
推荐指数
1
解决办法
1万
查看次数

Powershell将文件作为邮件附件发送

我需要检查文件是否存在于路径中.

如果是,我需要将其作为邮件附件发送.

我的代码现在:

$file='STREAM_preg.txt'
$pathfile ='c:\Users\root\Desktop'
$dest ='C:\Users\root\Desktop\test'

cd $pathfile
if(Test-Path $file){
        $datestamp = get-date -uformat "%Y%m%d%H%M"
    Copy-Item $file $dest\$datestamp"_"$file
    $new_file = echo $datestamp"_"$file
    echo $new_file
      # Send-MailMessage -SmtpServer xxxxxxxxxx -To pluto@pippo.com -From preg_new_stream@pippo.com -Subject "test mail" -Body "file name is: $new_file"
}else{
        echo false
}
Run Code Online (Sandbox Code Playgroud)

powershell sendmail powershell-2.0

2
推荐指数
1
解决办法
1万
查看次数

django替代EMAIL_HOST设置

我想实现django managment命令,该命令通过smtp发送电子邮件,而不使用settings.py文件中的默认设置,例如:

EMAIL_HOST
EMAIL_HOST_USER 
EMAIL_HOST_PASSWORD 
FROM_MAIL 
EMAIL_USE_TLS 
Run Code Online (Sandbox Code Playgroud)

我想使用不同于settings.py的替代设置发送邮件,而不更改所有站点的电子邮件设置。

如何实现呢?

django smtp sendmail

2
推荐指数
1
解决办法
1172
查看次数

邮件缺少发件人地址

我正在联系某个网站,但遇到了问题。我目前正在使用 XAMPP 进行测试,使用它的 sendmail。我不断收到错误:

邮件缺少发件人地址

这是 PHP 标头代码:

    //email headers
$headers = 'From: \""' .$email . '\r\n'. 'Reply-To' .
    $email. "\r\n" .
    'X-Mailer: PHP/' . phpversion();
    mail($email_to, $subject, $message, $headers);
Run Code Online (Sandbox Code Playgroud)

我想不通这个问题。谢谢

php sendmail

2
推荐指数
1
解决办法
9216
查看次数

使用命令行和 sendmail 发送带有多个附件的电子邮件

是否可以使用uuencode和发送多个附件sendmail

在脚本中,我有一个包含需要附加到单个电子邮件的文件的变量,例如:

$attachments=attachment_1.pdf attachment_2.pdf attachment_3.pdf attachment_4.pdf
Run Code Online (Sandbox Code Playgroud)

还有一个$template变量,如:

$template="Subject: This is the subject
From: no-reply@domain.com
To: %s
Content-Type: text/plain

This is the body.
"
Run Code Online (Sandbox Code Playgroud)

我想出了:

printf "$template" "$recipient" |
sendmail -oi -t
Run Code Online (Sandbox Code Playgroud)

在此范围内的某个地方,我必须附加$attachments变量中的所有内容?

email bash sendmail uuencode

2
推荐指数
1
解决办法
1万
查看次数

得到错误`没有名为mime.text`的模块[Python]

此代码"假设"发送电子邮件.

import smtplib
#SERVER = "localhost"

FROM = 'myEmail@email.com'

TO = ["toEmail@email.com"] # must be a list

SUBJECT = "Hello!"

TEXT = "This message was sent with Python's smtplib."

# Prepare actual message

message = """\
From: %s
To: %s
Subject: %s

%s
""" % (FROM, ", ".join(TO), SUBJECT, TEXT)

# Send the mail

server = smtplib.SMTP('myserver')
server.sendmail(FROM, TO, message)
server.quit()
Run Code Online (Sandbox Code Playgroud)

我收到此错误消息.

Traceback (most recent call last):
  File "C:\Users\myCpu\Documents\myFiles\python\test wy.py", line 1, in <module>
    import smtplib
  File "C:\Python27\lib\smtplib.py", line 46, …
Run Code Online (Sandbox Code Playgroud)

python email sendmail python-2.7

2
推荐指数
2
解决办法
1万
查看次数

Send-MailMessage:无法将“System.Object[]”转换为参数“Body”所需的类型“System.String”。不支持指定的方法

我正在尝试使用 powershell 发送电子邮件。电子邮件的正文将包含我运行的存储在变量中的 Get-ADuser 命令的结果。当我尝试下面的代码时,我收到错误“Send-MailMessage:无法将‘System.Object[]’转换为参数‘Body’所需的‘System.String’类型。不支持指定的方法。”

我在这里做的事情有什么问题吗?

$Value = Get-ADUser -Filter * -Properties propery.. | foreach { $_.propery..}
Send-MailMessage -From $From -To $To -Subject $Subject -Body $Value 
Run Code Online (Sandbox Code Playgroud)

powershell sendmail

2
推荐指数
1
解决办法
9611
查看次数