Sideas
asked on
Simple email script
I need to try and get a simple script to email a form and attach a file to it, if they choose to attach a file. Basically its a simple vacancy form where you can attach a CV. I have no experience in coding fom and stuff, so any help would be good. I usually pay to get this done, but the budget does not allow for this, so i might have to try do it myself :0/
Thanks for any help.
Thanks for any help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi guys,
Got so far on both of these but didn't get them working :-/
lucki_luke i got to here
http://www.idealogyltd.com/Email-form/email-form.html
I did put the sourceforge script up you can see it is there. http://www.idealogyltd.com/Email-form/
i_m_aamir i got to this point
http://www.idealogyltd.com/Email-form/email-form-2.html
Any help on both be great. I not sure what might be going wrong so don't know where to look. I guess its simple but as i don't know this stuff i cant figure it out.
Thanks again for trying to help a noob.
Got so far on both of these but didn't get them working :-/
lucki_luke i got to here
http://www.idealogyltd.com/Email-form/email-form.html
I did put the sourceforge script up you can see it is there. http://www.idealogyltd.com/Email-form/
i_m_aamir i got to this point
http://www.idealogyltd.com/Email-form/email-form-2.html
Any help on both be great. I not sure what might be going wrong so don't know where to look. I guess its simple but as i don't know this stuff i cant figure it out.
Thanks again for trying to help a noob.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I think i have amended them both correctly, now i get an error like so.
Warning: main(class.phpmailer.php): failed to open stream: No such file or directory in /data/webroot/default/Emai l-form/ema il.php on line 4
Fatal error: main(): Failed opening required 'class.phpmailer.php' (include_path='.:') in /data/webroot/default/Emai l-form/ema il.php on line 4
Think this is down to my URL or something. I guess this is quite hard.
Thanks for the offer ucitianz i cannot get you FTP access, company would not let it happen. Hopefully you guys can figure it out from there!
Warning: main(class.phpmailer.php):
Fatal error: main(): Failed opening required 'class.phpmailer.php' (include_path='.:') in /data/webroot/default/Emai
Think this is down to my URL or something. I guess this is quite hard.
Thanks for the offer ucitianz i cannot get you FTP access, company would not let it happen. Hopefully you guys can figure it out from there!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi,
Changed this, error on line 35 now
Parse error: parse error, unexpected $ in /data/webroot/default/Emai l-form/ema il.php on line 35
Sorry about this!
Changed this, error on line 35 now
Parse error: parse error, unexpected $ in /data/webroot/default/Emai
Sorry about this!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi,
That seems to have fixed it :0) not sure why it wasn't working, code looked the same.
That seems to have fixed it :0) not sure why it wasn't working, code looked the same.
<div style="height:15px"></div>
<table width="80%" align="center" border="1" class="Tb1">
<tr>
<td>
<form action="email.php?submit=y
<table width="93%" align="center" border="1" class="Tb1">
<tr class="headerrow">
<td colspan="2">
Send Email </td>
</tr>
<tr class="oddrow">
<td>
To: </td>
<td>
<input type="text" tabindex="1" name="receiver" size="50"> </td>
</tr>
<tr class="evenrow">
<td>
Subject: </td>
<td>
<input type="text" name="subject" size="50"> </td>
</tr>
<tr class="oddrow">
<td>
Message: </td>
<td>
<textarea name="message" cols="45" rows="10"></textarea> </td>
</tr>
<tr class="oddrow">
<td>Attatchment: </td>
<td><input id="fileatt" type="file" name="fileatt" tabindex="" /></td>
</tr>
<tr class="evenrow">
<td align="center" colspan="2">
<input type="submit" name="send" value="Send" class="buttons"> </td>
</tr>
</table>
</form> </td>
<form name="combo_box" action="send_email.php" method="post">
</form>
</tr>
</table>
<?
if($_GET['submit'] == 'yes')
{
// Message Receiver
$reciever = $_POST['receiver'];
// Message Sender
$subject = $_POST['subject'];
// Message
$message = $_POST['message'];
// Obtain file upload vars
$fileatt = $_FILES['fileatt']['tmp_na
$fileatt_type = $_FILES['fileatt']['type']
$fileatt_name = $_FILES['fileatt']['name']
$recievernames = explode(",", $reciever);
// Iterating Receiver Name's Array
$i = 0;
while($recievernames[$i])
{
$email = $recievernames[$i];
$headers = "From: aamir@post.com";
if (is_uploaded_file($fileatt
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($file
fclose($file);
// Base64 encode the file data
$data = chunk_split(base64_encode(
}
// Generate a boundary string
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$s
// Add the headers for a file attachment
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary
// Add a multipart boundary above the plain message
$message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/plain;\n charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding
$message . "\n\n" .
"--{$mime_boundary}\n";
// Add file attachment(s) to the message
if ($fileatt_name > "") {
$message .= "Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n
"Content-Transfer-Encoding
"Content-Disposition: attachment;\n" .
" filename=\"{$fileatt_name}
$data . "\n" .
"--{$mime_boundary}\n";
}
// Mail it
mail($email, $subject, $message, $headers);
$i++;
}
}
?>