Good Day
I have published a website and everything works expect for my forms. I can't seem to send the attachments to the email address according to the uploader. I don't know what i am doing wrong please help ............... .....i really need serious help
the field picture2, picture4 and video are uploaders
[php]<?php
$firstname = $_POST['FirstName'];
$lastname = $_POST['LastName'];
$email = $_POST['EmailAddress'];
$number = $_POST['ContactNumber'];
$NameOfAdvertis edItem = $_POST['NameOfAdvertis edItem'];
$Genres = $_POST['Genres'];
$Format = $_POST['Format'];
function mail_attachment ($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message) {
$file = $path.$filename ;
$file_size = filesize($file) ;
$handle = fopen($file, "r");
$content = fread($handle, $file_size);
fclose($handle) ;
$content = chunk_split(bas e64_encode($con tent));
$uid = md5(uniqid(time ()));
$name = basename($file) ;
$header = "From: ".$from_nam e." <".$from_mail." >\r\n";
$header .= "Reply-To: ".$replyto."\r\ n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"".$u id."\"\r\n\r\n" ;
$header .= "This is a multi-part message in MIME format.\r\n";
$header .= "--".$uid."\r\ n";
$header .= "Content-type:text/plain; charset=iso-8859-1\r\n";
$header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$header .= $message."\r\n\ r\n";
$header .= "--".$uid."\r\ n";
$header .= "Content-Type: application/octet-stream; name=\"".$filen ame."\"\r\n"; // use diff. tyoes here
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "Content-Disposition: attachment; filename=\"".$f ilename."\"\r\n \r\n";
$header .= $content."\r\n\ r\n";
$header .= "--".$uid."--";
if (mail($mailto, $subject, "", $header)) {
echo = "mail send ... OK"; // or use booleans here
} else {
echo = "mail send ... ERROR!";
}
}
// how to use
$my_file = "somefile.z ip";
$my_path = $_SERVER['DOCUMENT_ROOT']."/Main/Sign_up/upload/";
$my_name = "Olaf Lederer";
$my_mail = "mainsignup@con tiads.co.za";
$my_replyto = "info@contiads. co.za";
$my_subject = "This is a mail with attachment for ads.";
$my_message = "Hallo,\r\n do you like this script? I hope it will help.\r\n\r\ngr . Olaf";
mail_attachment ($my_file, $my_path, "mainsignup@con tiads.co.za", $my_mail, $my_name, $my_replyto, $my_subject, $my_message);
$Picture2 = $_POST['Picture2'];
$Picture4 = $_POST['Picture4'];
$video = $_POST['video'];
$ShortDescripti on = $_POST['ShortDescripti on'];
$country = $_POST['country'];
$Province = $_POST['Province'];
$CityTown = $_POST['CityTown'];
$Duration = $_POST['Duration'];
$tnc_agree = $_POST['tnc_agree'];
$to = "ContiAds! <mainsignup@con tiads.co.za>";
$subject = "RE: New ContiAds SignUp!";
$body = "<html>".
"<head>".
"<title>Con tact Request</title>".
"<style type='text/css'>".
"body,td,th {".
"font-family: Geneva, Arial, Helvetica, sans-serif;".
"font-size: 12px;".
"}".
".style1 {font-size: 24px}".
"</style></head>".
"<body>".
"<p align='center' class='style1'> ContiAds New Signup</p>".
"<table width='498' border='0' align='center' cellpadding='5' cellspacing='0' >".
"<tr>".
"<td colspan='2' valign='top' bgcolor='#33333 3' height='2px'></td>".
"</tr>".
"<tr>".
"<td width='104' valign='top'>Fu ll Name:</td>".
"<td width='374'>".$ firstname." ".$lastname ."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Co ntact Number:</td>".
"<td>".$number. "</td>".
"</tr>".
"<tr>".
"<td valign='top'>E-mail Address:</td>".
"<td>".$email." </td>".
"</tr>".
"<tr>".
"<td valign='top'>Nu mber of Advertised Items:</td>".
"<td>".$NameOfA dvertisedItem." </td>".
"</tr>".
"<tr>".
"<td valign='top'>Ge nres:</td>".
"<td>".$Genres. "</td>".
"</tr>".
"<tr>".
"<td valign='top'>Fo rmat:</td>".
"<td>".$Format. "</td>".
"</tr>".
"<tr>".
"<td valign='top'>Sh ort Description:</td>".
"<td>".$ShortDe scription."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Co untry:</td>".
"<td>".$country ."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Pr ovince:</td>".
"<td>".$Provinc e."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Ci ty / Town:</td>".
"<td>".$CityTow n."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Du ration:</td>".
"<td>".$Duratio n."</td>".
"</tr>".
"<tr>".
"<td colspan='2' valign='top' bgcolor='#33333 3' height='2px'></td>".
"</tr>".
"</table>".
"</body>".
"</html>";
//Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=is o-8859-1" . "\r\n";
$headers .= 'From: ' . $email . "\r\n";
//$headers .= 'Cc: myboss@example. com' . "\r\n";
if (mail($to, $subject, $body, $headers)) {
?>
<script language="javas cript" type="text/javascript">
location.replac e("Sign%20Up%20 Success.htm");
</script>
<?php
} else {
?>
<script language="javas cript" type="text/javascript">
location.replac e("Sign%20Up%20 Failure.htm");
</script>
<?php
}?>[/php] Please do not use uppercase cries for help and enclose your code within the appropriate code tags! See the Posting Guidelines on this. - moderator 3 1616 nomad 664
Recognized Expert Contributor
I looked at this somewhat quickly.
First I would start with just the First and Last name, See if you can make that work then continue to build it. Make it simple...
and you might have to many $header info. in your php code.
and who are you $mailto ???
nomad
Thank you for replying
I'm mailling it to the websites email address..Which i created using hosts pop3 email feature.
Thing is the other fields i do receive them when the form is submitted. Its the attachments that don't appear in the mail ! :-( and i really need them.
If possible could you please restructure the scripts in a way you think that will work best ! please
Please Help Me I'm Running Out Of Time
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: S_p_ike |
last post by:
Hi all,
I have a problem with mail with attachments.
To send e-mail with attachments from a form, I use Setec Astronomy's libmail
class (v 1.4) (available here http://www.phpclasses.org/)
Everything is ok but if I use a specific e-mail address (say address X) in
the field To, the e-mail arrives without attachments. (even if I use two
addresses for field To, of which one is address X, the mail to address X
arrives without attachments,...
|
by: tabonni |
last post by:
Hi
I try to grab the checked files from HTML page and then send those PDF
files as attachments. It can just send email, there are no PDF files
attached. Can anybody point out my error?
My idea is:
When people check the check boxes in HTML page for the PDF files, it
will transfer the files' name to ASP page. Then, it will attach it in
the email.
|
by: JulioHM |
last post by:
Hi all,
My question is quite simple. It´s about JavaMail API 1.3 and how it
handles file attachments. I've been googling around, but without luck.
Well, question is: How exactly does it handle attachments?
Consider a MultipartMessage with a 50MB attachment file. As I create
the message and pass the file's InputStream to it, does it load all of
the binary data into memory? Or is the InputStream accessed only when
|
by: Osiris Sawiris |
last post by:
I inherited an Inventory control application that updates the stock from the
branches at the end of each day. We receive the stock transactions via
e-mail attachments (Excel Sheets). Those attachments are currently being
stored manualll in a folder and then imported into the database using the
transferworksheet command. I'm facing 2 problems:
1) The imported excel sheets are stored in a table in the FE database for
processing and then...
|
by: Trond A. S. Andersen |
last post by:
Hi all,
I'm working on a project in which i need to send mail
attachments in the form of Excel documents from a .NET C#
application.
I've written a class which creates the Excel document
using the automation features provided by the
Excel.Application component. The Excel workbooks/documents
are stored locally before I call my SendExcelDocument()
method in order to attatch each document to an instance of
| |
by: Peter Wullems |
last post by:
I am trying to convert some code from VB to C# where VB.NET allows the
following:
MailItem.Attachments.Add(filename)
In the same situation C# appears to look for the following:
MailItem.Attachments.Add(object Source, object Type, object Position, object
DisplayName);
What should I supply to the parameters?
thanks
|
by: Peter Wullems |
last post by:
I use C# to parse incoming emails for a predefined type and structure of
message content and construct replies automatically, attach a file and place
the generated emails in the drafts folder. There I can review and decide
which ones to send.
The program was working fine the other day and then decided to stop with the
following message:
Can't create file: filename.doc. Right-click the folder you want to create
the file in, and then...
|
by: Liz Patton |
last post by:
Here's the exception:
System.Exception: Unable to send mail: Could not access 'CDO.Message'
object. ---> System.Web.HttpException: Could not access 'CDO.Message'
object. ---> System.Reflection.TargetInvocationException: Exception
has been thrown by the target of an invocation. --->
System.Runtime.InteropServices.COMException (0x80004005): Unspecified
error
--- End of inner exception stack trace ---
|
by: Steve Holden |
last post by:
I'm having some trouble getting attachments right for all recipients,
and it seems like Apple's mail.app is the pickiest client at the moment.
It doesn't handle attachments that both Thunderbird and Outlook find
perfectly acceptable.
Since the code I'm using is currently ugly and embedded, before I trim
it down for posting could anyone who's successfully generated emails
with attachments received by mail.app let me know if they had any...
|
by: Gianni Mariani |
last post by:
Attached example CPP files makes it easier to post code and extract code
from posts. It's unimaginable at this time where virtually any news
reader is capable of dealing with attachments to stick with such old
antiquated rules.
It's time for a change. I reccomend that the faq-5.4 bullet be changed:
http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.4
from:
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |