Hello , sir !
I am Ajinkya, I work in php. and I want to be perfect coder in php as soos as possible. And I try to my level very best. But sir, today I have a problem , can you help me !!
Sir, I want php code to , sent attachements with mail.
That is when I send mail to any friend at that I want to send some attachments with that mail , then what I want to do.
Ok !
Bye !
7 7720
please use given code then sent attechment mail to
alrge amount of mail id
regatds
arvind
php developer -
$sub=$_REQUEST[subject];
-
$msg=$_REQUEST[txtmail];
-
$filename=$_FILES["strresume"]["name"];
-
$filetype=$_FILES["strresume"]["type"];
-
$filesize=$_FILES["strresume"]["size"];
-
$filetemp=$_FILES["strresume"]["tmp_name"];
-
if(!empty($filetype)){
-
copy($filetemp,"upload_files/".$filename);
-
$source="upload_files/".$filename;
-
if($filetype=="application/octet-stream" or $filetype=="text/plain" or $filetype=="application/msword" )
-
{
-
$message= '<table cellspacing="1" cellpadding="1" border="0" width="100%">
-
<tr bgcolor="#eeeeee">
-
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'."$msg".'</td>
-
</tr>
-
</table>';
-
-
-
-
$fp = fopen($source, "rb");
-
$file = fread($fp, filesize($source));
-
-
$file = chunk_split(base64_encode($file));
-
$num = md5(time());
-
//Normal headers
-
-
$headers = "From: AllIndiaarchitects<admin@allindiaarchitects.com >\r\n";
-
$headers .= "MIME-Version: 1.0\r\n";
-
$headers .= "Content-Type: multipart/mixed; ";
-
$headers .= "boundary=".$num."\r\n";
-
$headers .= "--$num\r\n";
-
// This two steps to help avoid spam
-
// $headers .= "Message-ID: <".$now." TheSystem@".$_SERVER['SERVER_NAME'].">\r\n";
-
$headers .= "X-Mailer: PHP v".phpversion()."\r\n";
-
-
// With message
-
$headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";
-
$headers .= "Content-Transfer-Encoding: 8bit\r\n";
-
$headers .= "".$message."\n";
-
$headers .= "--".$num."\n";
-
// Attachment headers
-
$headers .= "Content-Type:".$filetype." ";
-
$headers .= "name=\"". $filename."\"r\n";
-
$headers .= "Content-Transfer-Encoding: base64\r\n";
-
$headers .= "Content-Disposition: attachment; ";
-
$headers .= "filename=\"". $filename."\"\r\n\n";
-
$headers .= "".$file."\r\n";
-
$headers .= "--".$num."--";
-
// SEND MAIL
-
if(is_array($email)){
-
foreach($email as $val){
-
@mail($val,$sub,$message, $headers);
-
}
-
}
-
fclose($fp);
-
unlink($source);
-
}
-
}
-
if(empty($filetype)){
-
$message= '<table cellspacing="1" cellpadding="1" border="0" width="100%">
-
<tr bgcolor="#eeeeee">
-
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'."$msg".'</td>
-
</tr>
-
</table>';
-
$headers = "From: AllIndiaarchitects<admin@allindiaarchitects.com >\r\n";
-
$headers .= "MIME-Version: 1.0\r\n";
-
$headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";
-
-
-
if(is_array($email)){
-
foreach($email as $val){
-
-
@mail($val,$sub,$message, $headers);
-
//echo $val."<br>";
-
//echo $message."<br>";
-
}
-
}
-
-
}
please use given code then sent attechment mail to
alrge amount of mail id
regatds
arvind
php developer
$sub=$_REQUEST[subject];
$msg=$_REQUEST[txtmail];
$filename=$_FILES["strresume"]["name"];
$filetype=$_FILES["strresume"]["type"];
$filesize=$_FILES["strresume"]["size"];
$filetemp=$_FILES["strresume"]["tmp_name"];
if(!empty($filetype)){
copy($filetemp,"upload_files/".$filename);
$source="upload_files/".$filename;
if($filetype=="application/octet-stream" or $filetype=="text/plain" or $filetype=="application/msword" )
{
$message= '<table cellspacing="1" cellpadding="1" border="0" width="100%">
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'."$msg".'</td>
</tr>
</table>';
$fp = fopen($source, "rb");
$file = fread($fp, filesize($source));
$file = chunk_split(base64_encode($file));
$num = md5(time());
//Normal headers
$headers = "From: AllIndiaarchitects<admin@allindiaarchitects.com >\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/mixed; ";
$headers .= "boundary=".$num."\r\n";
$headers .= "--$num\r\n";
// This two steps to help avoid spam
// $headers .= "Message-ID: <".$now." TheSystem@".$_SERVER['SERVER_NAME'].">\r\n";
$headers .= "X-Mailer: PHP v".phpversion()."\r\n";
// With message
$headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";
$headers .= "Content-Transfer-Encoding: 8bit\r\n";
$headers .= "".$message."\n";
$headers .= "--".$num."\n";
// Attachment headers
$headers .= "Content-Type:".$filetype." ";
$headers .= "name=\"". $filename."\"r\n";
$headers .= "Content-Transfer-Encoding: base64\r\n";
$headers .= "Content-Disposition: attachment; ";
$headers .= "filename=\"". $filename."\"\r\n\n";
$headers .= "".$file."\r\n";
$headers .= "--".$num."--";
// SEND MAIL
if(is_array($email)){
foreach($email as $val){
@mail($val,$sub,$message, $headers);
}
}
fclose($fp);
unlink($source);
}
}
if(empty($filetype)){
$message= '<table cellspacing="1" cellpadding="1" border="0" width="100%">
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'."$msg".'</td>
</tr>
</table>';
$headers = "From: AllIndiaarchitects<admin@allindiaarchitects.com >\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";
if(is_array($email)){
foreach($email as $val){
@mail($val,$sub,$message, $headers);
//echo $val."<br>";
//echo $message."<br>";
}
}
}
If you're going to *help* atleast use [.CODE=php]PHP code goes here.[/code]
Also, you gave no description of what your code does. The primary focus of this forum is to help people not to just supply code and expect them to understand it.
Thanks!
Thanks markusn00b,
to give me reply . Now I try to implement this code in my application. I later inform you about implementation .
Ok !
Bye !
Thanks arvindit11,
to reply me .
Now I try to implement this code in my application. I later inform you about implementation .
Ok !
Bye !
Hello arvind ,
Good evening. How r u?
Can you please explain me about variables,
$sub=$_REQUEST[subject];
$msg=$_REQUEST[txtmail];
I am waiting your reply .
By !
Sign in to post your reply or Sign up for a free account.
Similar topics
by: PeterR |
last post by:
I've spent weeks trying to write a function that is simple to use for
sending emails with attachments, but I my programming skills are not that
advanced. I've noticed a few postings in these...
|
by: knoak |
last post by:
Hi there,
I've found a script at these great Google fora. a script
to send emails with attachments.
The script is below this message, name etc. aren't mine, but from
the original post.
My...
|
by: theWizard1 |
last post by:
The following sends my email, but the attachment is empty. The attachment
should contain the data that is in the string that was created from the
xmlReader.
I have a stored procedure written...
|
by: rekaeps |
last post by:
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles
sending e-mail from the server when accessing the web site from a separate
client computer. Also, in the same scenario,...
|
by: dnuos |
last post by:
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles
sending e-mail from the server when accessing the web site from a separate
client computer.
Here's some details:
...
|
by: Robert Dufour |
last post by:
I am trying to use framework 1.1 - stuck with it. to send emails from a
windows form application. The email messages can have attachments, usually
two and they can be either text or sounds (wav...
|
by: William Connery |
last post by:
Hi,
I have a small python program with e-mail capabilities that I have pieced together from code snippets found on the internet.
The program uses the smtplib module to successfully send an...
|
by: nukephp |
last post by:
Hello Guys
would you know about php email with his attachment
Working on linux platform...................................................
The code as below:
mail.php
<?php
//define the...
|
by: maxxxxel |
last post by:
Hi
Can anyone help me with some asp code , I changed the code to use CDO.message instead of the old cdont.sys to send mail from a ASP webpage which works fine.
Our problem is that when we send...
|
by: raj200809 |
last post by:
when i m sending mail i received error from symantec Antivirus" Your email message was unable to be sent because your mail server rejected the message
550-5.7.1 the ip you’re using to send mail is...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
| |