我想尝试在PHP中发送带附件的电子邮件 [英] I want try to send email with attachment in PHP

查看:70
本文介绍了我想尝试在PHP中发送带附件的电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<?php 
if(isset($ _ POST ['submit']))
{
$ phone = $ _POST ['phone'];
$ email = $ _POST ['email'];
$ subject = $ _POST ['subject'];
$ deadline = $ _POST ['deadline'];
$ file = $ _POST ['file'];
$ comments = $ _POST ['comments'];
$ to = $ email;
$ headers =FROM:< parveen0055@gmail.com>;
$ message =电话:$ phone \ n \ n电子邮件:$ email \\\
\ n主题:$ subject \ n \ n截止日期:$ deadline \\\
\ n消息:
$评论;

if(mail($ to,$ subject,$ message,$ headers,$ attachment))
{
echoEmail Sent;
}
else
{
echo发送电子邮件时出错;
}
}
?>





< title>发送邮件



< p>电话及LT峰; br>
< / p>
< p>电子邮件< br>
< / p>
< p>主题< br>
< / p>
< p>截止日期< br>
< / p>
< p>附件< br>
< / p>
< p>评论< br>
< / p>
< p>< / p>




我尝试过:

i我试图附加任何类型的文件来发送邮件使用PHP,但文件不包括/

解决方案

_POST ['submit']))
{

电话=

_POST [ '电话'];

<?php
if(isset($_POST['submit']))
{
	$phone= $_POST['phone'];
        $email = $_POST['email'];
	$subject = $_POST['subject'];
        $deadline = $_POST['deadline'];
        $file = $_POST['file'];
        $comments = $_POST['comments'];
        $to = $email;
	$headers = "FROM:<parveen0055@gmail.com>";
	$message = "Phone: $phone\n\n Email: $email \n\n Subject: $subject \n\n  Deadline: $deadline \n\n Message: 
        $comments";

	if(mail($to, $subject, $message, $headers, $attachment))
	{
		echo "Email Sent";
	}
	else
	{
		echo "Error Sending Email";
	}
}
?>





<title>sending mail



<p>Phone<br>
</p>
<p>Email<br>
</p>
<p>Subject<br>
</p>
<p>Deadline<br>
</p>
<p>Attachment<br>
</p>
<p>Comments<br>
</p>
<p></p>




What I have tried:

i am trying to attach any type of file to send mail using php but file doesn't included/

解决方案

_POST['submit'])) {


phone=


_POST['phone'];


这篇关于我想尝试在PHP中发送带附件的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆