A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: Issue with flashmo contact form

  1. #1
    Junior Member
    Join Date
    Sep 2015
    Posts
    7

    Unhappy Issue with flashmo contact form

    Ok so i am using the flashmo_269_dragonfly template from flashmo but it will not send out email at all.
    the code highlighted red is where it asks in the template for a sender email. i omitted mine for now
    but the site will not send any email at all. anyone got an idea why?
    do i have to open a port for this template to work? if so what one?

    flashmo code inside:
    Code:
    // C o p y r i g h t   ©   f l a s h m o . c o m
    // D e v e l o p e d   b y   M i n  T h u
    
    stop();
    contact_name.text = contact_email.text = contact_subject.text = 
    contact_message.text = message_status.text = "";
    
    send_button.addEventListener(MouseEvent.CLICK, submit);
    reset_button.addEventListener(MouseEvent.CLICK, reset);
    
    var receiver_email:String = "your.email@mail.com";
    var timer:Timer;
    var var_load:URLLoader = new URLLoader;
    var URL_request:URLRequest = new URLRequest( "send_email.php" );
    URL_request.method = URLRequestMethod.POST;
    
    function submit(e:MouseEvent):void
    {
    	if( contact_name.text == "" || contact_email.text == "" ||
    		contact_subject.text == "" || contact_message.text == "" )
    	{
    		message_status.text = "* Please fill up all text fields.";
    	}
    	else if( !validate_email(contact_email.text) )
    	{
    		message_status.text = "* Please enter the valid email address.";
    	}
    	else
    	{
    		message_status.text = "sending...";
    		
    		var email_data:String = "name=" + contact_name.text
    					   + "&email=" + contact_email.text
    					   + "&subject=" + contact_subject.text
    					   + "&message=" + contact_message.text
    					   + "&receiver_email=" + receiver_email;
    					   
    		var URL_vars:URLVariables = new URLVariables(email_data);
    		URL_vars.dataFormat = URLLoaderDataFormat.TEXT;
    		
    		URL_request.data = URL_vars;
    		var_load.load( URL_request );
    		var_load.addEventListener(Event.COMPLETE, receive_response );
    	}
    }
    
    function reset(e:MouseEvent):void
    {
    	contact_name.text = contact_email.text = contact_subject.text = 
    	contact_message.text = message_status.text = "";
    }
    
    function validate_email(s:String):Boolean 
    {
    	var p:RegExp = /(\w|[_.\-])+@((\w|-)+\.)+\w{2,4}+/;
    	var r:Object = p.exec(s);
    	if( r == null ) 
    	{
    		return false;
    	}
    	return true;
    }
    
    function receive_response(e:Event):void
    {
    	var loader:URLLoader = URLLoader(e.target);
        var email_status = new URLVariables(loader.data).success;
    	
    	if( email_status == "yes" )
    	{
    		message_status.text = "Success! Your message was sent.";
    		timer = new Timer(500);
    		timer.addEventListener(TimerEvent.TIMER, on_timer);
    		timer.start();
    	}
    	else
    	{
    		message_status.text = "Failed! Your message cannot be sent.";
    	}
    }
    
    function on_timer(te:TimerEvent):void 
    {
    	if( timer.currentCount >= 10 )
    	{
    		contact_name.text = contact_email.text = contact_subject.text = 
    		contact_message.text = message_status.text = "";
    		timer.removeEventListener(TimerEvent.TIMER, on_timer);
    	}
    }
    and the php pages are as follows.

    send_email.php

    Code:
    <?php
    $contact_name = $_POST['name'];
    $contact_email = $_POST['email'];
    $contact_subject = $_POST['subject'];
    $contact_message = $_POST['message'];
    $receiver_email = $_POST['receiver_email'];
    
    if( $contact_name == true )
    {
    	$sender = $contact_email;
    	$receiver = $receiver_email;
    	$client_ip = $_SERVER['REMOTE_ADDR'];
    	$email_body = "Name: $contact_name \nEmail: $sender \n\nSubject: $contact_subject \n\nMessage: \n\n$contact_message \n\nIP: $client_ip \n\nFlash Contact Form provided by http://www.flashmo.com";		
    	$extra = "From: $sender\r\n" . "Reply-To: $sender \r\n" . "X-Mailer: PHP/" . phpversion();
    
    	if( mail( $receiver, "Flash Contact Form - $contact_subject", $email_body, $extra ) ) 
    	{
    		echo "success=yes";
    	}
    	else
    	{
    		echo "success=no";
    	}
    }
    ?>
    send_email_auto_response.php

    Code:
    <?php
    $contact_name = $_POST['name'];
    $contact_email = $_POST['email'];
    $contact_subject = $_POST['subject'];
    $contact_message = $_POST['message'];
    $receiver_email = $_POST['receiver_email'];
    
    if( $contact_name == true )
    {
    	$sender = $contact_email;
    	$receiver = $receiver_email;
    	$client_ip = $_SERVER['REMOTE_ADDR'];
    	
    	$email_body = "Name: $contact_name \nEmail: $sender \n\nSubject: $contact_subject \n\nMessage: \n\n$contact_message \n\nIP: $client_ip \n\nFlash Contact Form provided by http://www.flashmo.com";
    	$email_body_auto_reply = "Hello $contact_name, \nThis is the auto reply message. Thank you. \n\nAdmin - http://www.flashmo.com";
    	
    	$extra = "From: $sender\r\n" . "Reply-To: $sender \r\n" . "X-Mailer: PHP/" . phpversion();
    	$extra_auto_reply = "From: $receiver\r\n" . "Reply-To: $receiver \r\n" . "X-Mailer: PHP/" . phpversion();
    	
    	mail( $sender, "Auto Reply - Re: $contact_subject", $email_body_auto_reply, $extra_auto_reply );	// auto reply mail to sender
    
    	if( mail( $receiver, "Flash Contact Form - $contact_subject", $email_body, $extra ) )
    	{
    		echo "success=yes";
    	}
    	else
    	{
    		echo "success=no";
    	}
    }
    ?>

  2. #2
    Junior Member
    Join Date
    Sep 2015
    Posts
    7
    basically it gets to sending and stays at sending... and never goes any further than that.

  3. #3
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    It works for me, try using if( @mail. on both php files, I only tried with the send_email.php

  4. #4
    Junior Member
    Join Date
    Sep 2015
    Posts
    7
    Quote Originally Posted by fruitbeard View Post
    Hi,

    It works for me, try using if( @mail. on both php files, I only tried with the send_email.php
    Did it send mail to you? are you using the same flashmo_269_dragonfly template? because now all it does is fail to send.... I doubt that is what is broken. it does the same if i add a ! or a # or a % or a &.... i doubt that the @ symbol is the fix for this template but thanks for trying to help. Anyone else know why its not sending mail??

  5. #5
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Yes it did send mail to my address using your code no changes apart from the @ sign, it did not work without the @ sign, forget the other signs, @ sign only, have you tried it using the @ sign?

    It worked, do you have php installed, it will not work from within flash.

  6. #6
    Junior Member
    Join Date
    Sep 2015
    Posts
    7
    Quote Originally Posted by fruitbeard View Post
    Hi,

    Yes it did send mail to my address using your code no changes apart from the @ sign, it did not work without the @ sign, forget the other signs, @ sign only, have you tried it using the @ sign?

    It worked, do you have php installed, it will not work from within flash.

    Yes i have php5 installed and my phpbb3 forum install sends mail but this template does not.

    if( @mail( $receiver, "Flash Contact Form - $contact_subject", $email_body, $extra ) )

    and yes i have perged my cache and deleted all app data from my browser and even restarted apache but it
    does not send mail to my email. it just says: Failed! Your message cannot be sent.

    i also have these ports open for a mail server

    YAofM2E.png
    Last edited by ssfrostic; 09-29-2015 at 02:12 PM. Reason: Added an image of port forwarding

  7. #7
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Are you hosting your own server using wamp/xamp etc etc

    If so then you possibly need to configure your smtp server or try something else.

    http://stackoverflow.com/questions/3...t-installation
    http://stackoverflow.com/questions/1...smtp-localhost

    If not then I have no idea what is wrong, perhaps you need the correct <params> in the flash/html/php file.

    it works using my test albeit uploaded to my own site.

  8. #8
    Junior Member
    Join Date
    Sep 2015
    Posts
    7
    Quote Originally Posted by fruitbeard View Post
    Hi,

    Are you hosting your own server using wamp/xamp etc etc

    If so then you possibly need to configure your smtp server or try something else.

    http://stackoverflow.com/questions/3...t-installation
    http://stackoverflow.com/questions/1...smtp-localhost

    If not then I have no idea what is wrong, perhaps you need the correct <params> in the flash/html/php file.

    it works using my test albeit uploaded to my own site.
    no i am not using wamp/xamp It is a windows server with Apache 2.4.10, php 5.6.4, Mysql server 2008...
    I don't like wamp/xamp because of the configurations are limited and never have the proper moduales loaded.
    I have setup smtp properly as it works for any other template. it also works with phpbb3. it is only this 1 template that is having the issue.

  9. #9
    Junior Member
    Join Date
    Sep 2015
    Posts
    7
    nevermind. tried different email servers none work.

  10. #10
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi

    I assure you it works here, look here, http://fruitbeard.net/testing/form.html

    I have tweaked it so both mails go to the mail input address, so try your own mail address.

    Both reply and response will probably end up in your spam folder as do a lot of mail using php mail().
    It might take up to 10 minutes too.

    You should attach your fla as it could be that seeing it stops at "sending";
    Last edited by fruitbeard; 09-30-2015 at 01:51 AM.

  11. #11
    Junior Member
    Join Date
    Sep 2015
    Posts
    7

    resolved resolved

    Quote Originally Posted by fruitbeard View Post
    Hi

    I assure you it works here, look here, http://fruitbeard.net/testing/form.html

    I have tweaked it so both mails go to the mail input address, so try your own mail address.

    Both reply and response will probably end up in your spam folder as do a lot of mail using php mail().
    It might take up to 10 minutes too.

    You should attach your fla as it could be that seeing it stops at "sending";
    i got it to work. it was the flash page its self. i was not supposed to edit the email address in the form's code. it was pulling the info from the menu xml file. kinda strange place for it but it is working now.

    <config image_folder="images" css_file="style.css" receiver_email="email@address.here">
    </config>

    they need to put setup instructions to these templates....

    adding the @ symbol did make it work once i reset it up a second time.

  12. #12
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Told you it worked.

    Probably could have saved a lot of headache had you mentioned the config file / code at first, but welll done.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center