Printer Friendly Version
Email this thread to a friend
|
Chinese E-mail Scam from Beijing ALG Network Infor (In: Google)
Featured Web Site Template |
|
Reflects user activity within the last 5 minutes
|
|
| Member |
Message |
merc1
Joined: Mar 03, 2005
# Posts: 2
|
Posted: 2005-Mar-03 13:07
Learning PHP now, can anyone help me to create a barebone code for the following? By barebone, I mean do not need data validation, etc. Just to show me how it work will do!
----------------------------------
WHAT I NEED:
----------------------------------
1. I have a site name "MyWeb.com"
2. I have a file at this path: MyWeb/Hello.html
3. I have a form with only 1 field. The fieldname is "VisitorEmail".
4. Visitor to my site will fill in his email at my form page.
5. The form will call a PHP script.
6. The script will send an email with Hello.html as attachment to the visitor, the email content is "Please open the attachment, thank you".
----------------------------------
----------------------------------
Thanks!
|
 |
lizardz
Joined: Nov 12, 2004
# Posts: 1394
|
Posted: 2005-Mar-04 02:53
It works better to try to do this yourself, post the code from the area you are having problems with, and then usually people will help you. Try to get it working, make a real effort, then post the problematic code. You can't learn programming without putting out any effort.
|
 |
merc1
Joined: Mar 03, 2005
# Posts: 2
|
Posted: 2005-Mar-04 11:33
Thanks! This is why I ask for only barebone system. My problem is step(6) ---> I totally have no idea how to start although I know it is possible.
Please help!
|
 |
NEntropy
Joined: Dec 08, 1999
# Posts: 1117
|
Posted: 2005-Mar-04 19:57
If your PHP is set properly, the easiest way to do it us to use the built in mail function of PHP. The PHP manual page has explanation and exams code to get you started. It's fairly easy function to use.
|
 |
lizardz
Joined: Nov 12, 2004
# Posts: 1394
|
Posted: 2005-Mar-04 20:23
link. That should do it for you.
Re mail(), that wouldn't do it for this question.
|
 |
langard
Joined: Dec 15, 1999
# Posts: 339
|
Posted: 2005-Mar-15 08:16
Try this for sending. Headers are important nowadays. Fill in the blanks yourself. Note: This posting takes away the necessary backslashes before the newlines - n - in the code below. You'll have to put them in if you copy it. Oh...yeah it took the backslashes out of the full quotes in the "DOCTYPE" definition too.
/*********MAIL NOTIFICATION**************/
// some local variables
$from_name = "You";
$from_email = "you@you.com";
$to_name = "Them";
$to_email = "them@them.com";
$subject = "Some subject";
// headers need to be in the correct order...
$headers = "From: $from_name<$from_email>n";
$headers .= "Reply-To: <$from_email>n";
$headers .= "MIME-Version: 1.0n";
// the following must be one line (post width too small)
$headers .= "Content-Type: text/html; charset="iso-8859-1"; Content-Transfer-Encoding: quoted-printablen";
$headers .= "X-Sender: $from_name<$from_email>n";
$headers .= "X-Mailer: PHP4n"; //mailer
$headers .= "X-Priority: 3n"; //1 UrgentMessage, 3 Normal
$headers .= "Return-Path: <$from_email>n";
// your html goes here -- It didn't appear properly without
// the weird markup that outlook added after sending
$message = "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">n";
$message .= "<HTML><BODY>n";
$message .= "Put whatever HTML you want in here or call the whole works with an include statement.";
$message .= "</BODY></HTML>n";
$message .= "n";
// send the message
mail("$to_name<$to_email>", $subject, $message, $headers);
[ Message was edited by: langard 03/15/2005 12:34 am ]
|
 |
lizardz
Joined: Nov 12, 2004
# Posts: 1394
|
Posted: 2005-Mar-15 09:07
The poster needs something that will add an attachment to the email, why, I don't know, but that's what he asked for. A lot easier to just insert the email text into the body of the sent email if you ask me, then your method would work fine.
|
 |
g1smd
Staff
Joined: Jul 28, 2002
# Posts: 10418
|
Posted: 2005-Mar-15 10:39
I guess the attachment is a word document, an image, or a zip file, or something.
I hope it isn't a virus or trojan.
|
 |
lizardz
Joined: Nov 12, 2004
# Posts: 1394
|
Posted: 2005-Mar-15 22:35
That was my suspicion to be honest.
|
 |
langard
Joined: Dec 15, 1999
# Posts: 339
|
Posted: 2005-Mar-15 22:58
I understood he wanted to send "Hello.html". Why he doesn't just stick it in the code above instead of using a text message trailer to announce an attachment, I can't say.
Perhaps the Poster could enlighten us. It'd be even easier to just email a link to the URL of Hello.htm for that matter and avoid sending the page altogether.
|
 |
You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
- You have not yet logged in, or registered properly as a member
- You are a member, but no longer have posting rights.
- This is a private forum, for which you do not have permissions.
If you are a recent member, it's possible that you simply have not yet confirmed your account. Please
check your email for a message entitled 'JimWorld Forums: Confirm Your Account' and follow the instructions
contained within.
If you cannot find this message, click here to Re-Send it.
|
If you are still experiencing problem, please read the
Login Assistance
Article for some advice on what may be causing your login not to work properly.
|
Switch to Advanced Editor and ...
Create a New Topic
or Reply to this Thread
|
|