Forum Moderators: coopster
I have a website for a small business (publishing), and would like people to be able to go to my site and submit for advertisements in our weekly paper. Now I wanted this to be an all-in-one kind of thing, it will take them to an SSL directory where it will take their personal info, billing and Credit Card, AND (this is the part I can't get to work) an attachment (PDFs, Jpgs, Docs, mainly). Now I've tried several different mail forms, and all of them (some with a little tweeking), send the message with no attachment. Now before we start troubleshooting, some things needs to be said, because I have a haunch that it has something to do with:
1) I am using Yahoo! web hosting
2) Yahoo! will not allow the FROM address to be from any other domain except that which is doing the sending
3) Can only send 250 per day
You get where I am going with this? What other limitations does Yahoo! hosting have? I wonder if there is a ban on all PHP mail attachments from this host? If not, then I am stumped, as I have tried mail(), Mime, even Pear... I called Yahoo! and simply asked them if they support attachments, and you know what they said? "We don't support PHP help requests, visit the php website for support". There you have it, in other words... "Ummmm, that's not in my book here, and when I type in your problem on my computer I don't get any results. I'm just a flunky who has no idea what you're talking about, so... I guess call the php people, they'll know what WE support."
any input would be GREATLY appreciated!
[edited by: coopster at 3:49 pm (utc) on Dec. 3, 2004]
[edit reason] removed url per TOS [webmasterworld.com] [/edit]
welcome to webmasterworld! :)
not quite what you asked, but are you going to be encrypting the personal info (and especially the credit card info) before sending it by email?
the reason i ask is that just because it is entered in ssl, doesn't mean it is ecnrypted between the ssl server and your inbox. pgp would be one way to do it. (if you have thought about this then please ignore ;-)
re: the mailing: have you tried using a ready made class (not re-inventing the wheel, etc). phpmailer is a good one, which makes it very easy to send attachments, etc. i think you'd first of all have to store the soon-to-be-attached files in a directory somewhere before actually sending them. although someone may come up with a better idea?
hope that helps a bit
jamie,
I read in the class the following; it may, or may not be relevant to the reason you can't get CC to work, but just the same, I thought I'd share:
* Adds a "Cc" address. Note: this function works
* with the SMTP mailer on win32, not with the "mail"
* mailer.
<?php
require("class.phpmailer.php");$mail = new PHPMailer();
$mail->IsSendmail(); // set mailer to use Sendmail
$mail->From = "return@my other domain.net";
$mail->FromName = "Mailer";
$mail->AddAddress("me "zak" @mydomain.com"); // name is optional
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->AddAttachment("/Users/zak/Desktop/libmail.txt"); // add attachments
// $mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = "This is a test!";
$mail->Body = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
else
{
echo "Message has been sent";
}
?>
If it's not, then your problem isn't with sending the attachment, it's with uploading the attachment.
1) I created a simple HTML form for upload...
[code]
<form enctype="multipart/form-data" action="upload.php" method="POST">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="300000" />
<!-- Name of input element determines name in $_FILES array -->
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>
[\code]
2) I created a simple php to proccess it.. (I also substituted $_FILES with $HTTP_POST_FILES as per the php website incase I had a earlier version I was dealing with and it made no difference)
[code]
<?php
$uploaddir = 'load/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
{
echo "File is valid, and was successfully uploaded.\n";
}
else
{
echo "Why didn't you upload, you SOB?!<br><br>\n";
}
echo 'Here is some more debugging info:<br><br>';
print_r($_FILES);
echo "Loadfile is: $uploadfile<br>";
echo "LoadDir is: $uploaddir<br>";
?>
[\code]
3) And finally the output of the process. It seems as though I can't upload files... hhhmmmm This is the output from the above php file.
[code]
Why didn't you upload, you SOB?!
Here is some more debugging info:
Array ( ) Loadfile is: load/
LoadDir is: load/
[\code]