Sending email

This is a discussion on "Sending email" within the PHP Forum section. This forum, and the thread "Sending email are both part of the Program Your Website category.



 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1  
Old Jul 9th, 2006, 15:38
Junior Member
Join Date: Jul 2006
Location: spain
Age: 20
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Sending email

Right i have been searching and searching, i have found out that php is the language to use to work with forms and databases. My question is how do you send a email using php i have tried the mail() function and it doesnt work!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Jul 9th, 2006, 22:20
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Sending email

Have a look at http://1ontheweb.net/1ontheweblog.html and download the two files associated with the 'Fighting back against the spam' article that I wrote a while back.

There is a file with all the code you need with explanations of what is happening.

Work through that and you will know how to create forms with php and use its mail() function.

Any queries, come back here and ask.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Jul 9th, 2006, 22:20
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Sending email

Show us your code.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Jul 10th, 2006, 10:55
Junior Member
Join Date: Jul 2006
Location: spain
Age: 20
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Sending email

I have been reading and found my mail() code was wrong, it now sends a email, but it is labeled as junk email. I have been reading in the forums and seen someone had the same problem but you thought he was a spammer so no answer is given. So hopefully if i give you the reason why i want this auto email you will help me, i am building a form and when this form is filled out a email will be sent to me with the answers from the form.

Here is my php code now

<?php
if(mail("********@hotmail.com","Test","This is to test the PHP MAIL()", "From: info@mysite.com"))
print('<p>WORKED</p>');
else print('<p>NOT WORKED</p>');
?>

i originally had no From: and thought that this might be why its labeled as junk, but obviously not.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Jul 10th, 2006, 11:05
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Sending email

It won't be being labelled as 'junk' by the php processing.

This is being done by someone's email filtering. Hotmail or yours.

I would guess this is most likely happening because of your subject, 'test'. Try a real subject and some proper content and see what happens.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Jul 10th, 2006, 11:19
Junior Member
Join Date: Jul 2006
Location: spain
Age: 20
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Sending email

I have done as you said but no change still being labeled as junk, but i have found that i can labelthe email address as not being junk email and it can get through, at last. But if i was unable to label it as not being junk, as i may have to send it to another email address is their anything i can do.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Jul 10th, 2006, 11:49
Junior Member
Join Date: Mar 2006
Age: 21
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Sending email

The following code is basic and may well get picked to bits but it works. You'll need a mail server for it to run. You'll have to put a valid email address at the "$MailToAddress = "put the recipients email here" part of the code 2 thirds down. Hope this works OK.

<html>
<head>
<title>Email Jagprops</title>
<link rel="stylesheet" type="text/css"
//href="css3.css"/>
</head>
<body>

<form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>" >
<p style="line-height: 100%; margin: 0">
<img border="0" src="star.gif" width="206" height="43" vspace="7">
<p style="line-height: 100%; margin: 0">

<input name="youremail" type="text" size="35"/>&nbsp;

<font color="#800000" size="2" face="Century Gothic"><b>your
email</b></font>

<p style="line-height: 100%; margin: 0"><font color="#800000" size="2" face="Century Gothic"><b><br>

<input name="subject" type="text" size="35"/>&nbsp; subject</b></font>
</p>

<p style="line-height: 100%; margin: 0"><br>

<TEXTAREA NAME="comments" ROWS="20" cols="40">enter your message/query here</TEXTAREA>
<br>

</p>
<input type="submit" value = submit />
</form>

<?
$MailFromAddress = $_GET['youremail'];
$MailSubject = $_GET['subject'];
$Message= $_GET['comments'];

$MailToAddress = "put the recipients email here";
if (!$MailFromAddress) {
$MailFromAddress = "SENDERS@ADDRESS.GOES.HERE";
}
else{
mail( "$MailToAddress", "$MailSubject", "$Message", "From: $MailFromAddress");
echo "Thank you, your email has been received.";
}
?>

<br><br>
<a href="/"><font size="2" face="Century Gothic" color="#000080">Home Page</font></a><br><br>
</body>
</html>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
sending, email

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP email form not sending email Kurt PHP Forum 1 Oct 12th, 2007 04:26
sending email fails flann Hosting & Domains 1 Feb 17th, 2007 23:38
sending email arrays with php ppgpilot PHP Forum 2 Jan 25th, 2007 16:49
Email + attachment sending manzil PHP Forum 1 Aug 4th, 2006 13:40
Sending Email Paul00000001 JavaScript Forum 3 Jul 29th, 2006 03:16


All times are GMT. The time now is 02:55.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42