28, May 2012

strange thing with phpmailer form - webmaster forum

 
Webdigity webmaster forums
[ 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
Instabuck - The easy way to sell digital products online

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


It's time to use PHP5!


« on: Apr 26, 2007, 10: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?

I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #1 on: Apr 26, 2007, 10: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 or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #2 on: Apr 26, 2007, 10: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();
}


Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Apr 26, 2007, 10: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;
    }
}

I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #4 on: Apr 26, 2007, 10: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 or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #5 on: Apr 26, 2007, 10: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???)

Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #6 on: Apr 26, 2007, 10: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: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #7 on: Apr 26, 2007, 11:02:37 am »

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

Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #8 on: Apr 26, 2007, 11:30:44 am »

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....

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?
May 28, 2012, 08:40:06 pm





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!






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