5, September 2008

strange thing with phpmailer form - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: strange thing with phpmailer form
« previous next »
Pages: [1] Print

Author Topic: strange thing with phpmailer form  (Read 662 times)
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6307
38662 credits
Members referred : 374


It's time to use PHP5!


« on: Apr 26, 2007, 11:11:20 AM »

Hi,

I changed some webform yesterday and I'm using now phpmailer and send the email through SMTP.

today I got an error from the mail server and noticed that someone tried to send a mail via this domain.

2 minutes before I got from the same attempt a regular (span) message send by the same client.

the subject and mailto address is hard coded but the mail has its own subject and a different mailto address.

Is it possible that someone has send this mail because I didn't closed the connection?


Last blog : Is your website is down? Know before your visitors do!
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8037
41179 credits
Members referred : 3



« Reply #1 on: Apr 26, 2007, 11:15:45 AM »

The connection should die when the script finish running.

Maybe you have a bug in your mailform that allows someone to use other email address or something?

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6307
38662 credits
Members referred : 374


It's time to use PHP5!


« Reply #2 on: Apr 26, 2007, 11:22:11 AM »

The connection should die when the script finish running.

Maybe you have a bug in your mailform that allows someone to use other email address or something?

don't think so the only thing I didn't used was the quit method, check:

Code:
<?php
if (check_email(trim($_POST['email']))) {
$email preg_replace("/\r\n/"""$_POST['email']);
$from preg_replace("/\r\n/"""$_POST['naam']);
$contact_mail_subject $type_info[preg_replace("/\r\n/"""$_POST['onderwerp'])];
$body "Dit bericht wordt verzonden op ".date($date_order." H:i:s")." via het contactformulier van address.eu.\n\n";
$body .= "Het bericht is:\n\n";
$body .= stripslashes($_POST['bericht']);

$mail = new PHPMailer();
$mail->IsSMTP();  
$mail->Host "smtp.address.eu";  
$mail->SMTPAuth true;  
$mail->Username "user";  
$mail->Password "passwd"

$mail->From "mymail@address.eu";
$mail->FromName "webmaster";
$mail->AddAddress("mymail@address.eu");
$mail->AddReplyTo($email$from);

$mail->Subject "Aanvraag: ".$contact_mail_subject." - ".date("Y-m-d H:i:s");
$mail->Body $body;

$mail->Send();
}



Last blog : Is your website is down? Know before your visitors do!
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6307
38662 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Apr 26, 2007, 11:23:47 AM »

this is the mail address check I do:

Code:
<?php
function check_email($mail_address) {
global $msg;
    
$pattern "/^[\w-]+(\.[\w-]+)*@([0-9a-z][0-9a-z-]*[0-9a-z]\.)+([a-z]{2,4})$/i";
    if (
preg_match($pattern$mail_address)) {
        
$parts explode("@"$mail_address);
        if (
checkdnsrr($parts[1], "MX")){
            return 
true;
        } else {
            
$msg "Deze e-mailadres is niet bereikbaar.";
            return 
false;
        }
    } else {
        
$msg "Deze e-mailadres bevat ungeldige tekens.";
        return 
false;
    }
}


Last blog : Is your website is down? Know before your visitors do!
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8037
41179 credits
Members referred : 3



« Reply #4 on: Apr 26, 2007, 11:25:41 AM »

This code looks ok.

Personally I haven't used the quit method never, but I use the Sendmail method of sending ( $mailer->isSendmail(); or something like that Smiley )

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6307
38662 credits
Members referred : 374


It's time to use PHP5!


« Reply #5 on: Apr 26, 2007, 11:27:28 AM »

This code looks ok.

Personally I haven't used the quit method never, but I use the Sendmail method of sending ( $mailer->isSendmail(); or something like that Smiley )

will say you're using sendmail for the smtp function? (wondering what I'm using???)


Last blog : Is your website is down? Know before your visitors do!
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #6 on: Apr 26, 2007, 11:53:51 AM »

Got some error in your error message: it should be 'Dit e-mail adres' and 'ongeldige' Wink


Last blog : Are You Stumbling Yet?
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6307
38662 credits
Members referred : 374


It's time to use PHP5!


« Reply #7 on: Apr 26, 2007, 12:02:37 PM »

Got some error in your error message: it should be 'Dit e-mail adres' and 'ongeldige' Wink

thanks I hope it help to ban the spammer Cheesy


Last blog : Is your website is down? Know before your visitors do!
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #8 on: Apr 26, 2007, 12:30:44 PM »

Probably not, but it will keep the spelling-police off your back Wink


Last blog : Are You Stumbling Yet?
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=6461
Tags : phpmailer spam Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: strange thing with phpmailer form
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Sep 05, 2008, 07:49:28 AM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 36.290
Total Topics: 7.476
Total Members: 3.897
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: FlorianHofmann

16 Guests, 3 Users online :

14 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.