On submit form send record to email

Rather than using workflow you could create an after_save logic hook

In that you pull all the data you need together and send an email

What I do is use email templates as a template

See my code below


// get template
		$et = new EmailTemplate ();
		
		$et->retrieve_by_string_fields ( array (
				'name' => 'Case Notification' 
		) );
		
		$body = $et->body_html;
		$body = $TplReplace ( $body, $bean, 'cases' );
		$subject = $et->subject;
		$subject = $TplReplace ( $subject, $bean, 'cases' );
		
		$user = BeanFactory::getBean ( 'Users', $bean->assigned_user_id );
		$primary_email = $user->emailAddress->getPrimaryAddress ( $user );
		
		$from = $bean->to_addrs;
		if (! $from) {
			$user = BeanFactory::getBean ( 'Users', $bean->modified_user_id );
			$from = $user->emailAddress->getPrimaryAddress ( $user );
		}
		
		$mail = array (
				'subject' => $subject,
				'Body_html' => from_html ( $body ),
				'body' => wordwrap ( $body, 900 ),
				'from' => $from,
				'to' => array (
						$primary_email 
				),
				'FromName' => $bean->assigned_user_name 
		);
		$SendMail ( $mail, true );
		// --------------------------------------------------------------------------------------------
		function TplReplace($text, $bean, $tpl) {
		// replace varial - used for em,ail templates
		
		// create href_link
		global $app_list_strings;
		global $sugar_config;
		
		$link = "{$sugar_config['site_url']}/index.php?module={$bean->module_dir}&action=DetailView&record={$bean->id}";
		
		$bean->href_link = "<a href=\"$link\">Click Here</a>";
		
		foreach ( $bean as $k => $v ) {
			if (is_string ( $v ))
				$text = preg_replace ( "/\{$tpl::$k\}/", $v, $text );
		}
		
		return $text;
	}
	
	// --------------------------------------------------------------------------------------------
	function SendMail($mail, $html = false) {
		require_once ('include/SugarPHPMailer.php');
		$note_msg = new SugarPHPMailer ();
		$note_msg->Subject = $mail ['subject'];
		$note_msg->prepForOutbound ();
		$note_msg->setMailerForSystem ();
		$note_msg->Body = $mail ['body'];
		$note_msg->From = $mail ['from'];
		
		// $GLOBALS ['log']->fatal ( 'from: ' . $mail ['from'] );
		// $GLOBALS ['log']->fatal ( 'fromname: ' . $mail ['FromName'] );
		
		$note_msg->FromName = preg_replace ( '/<.*>/', '', $mail ['FromName'] );
		$note_msg->IsHTML ( $html );
		if ($html == true)
			$note_msg->Body_html = $mail ['Body_html'];
		
		foreach ( $mail ['to'] as $to )
			$note_msg->AddAddress ( $to );
		
		foreach ( $mail ['cc'] as $cc )
			$note_msg->AddCC ( $cc );
		
		$note_msg->prepForOutbound ();
		$note_msg->setMailerForSystem ();
		
		if (! $note_msg->Send ()) {
			$GLOBALS ['log']->fatal ( 'Error sending e-mail: ' . $note_msg->ErrorInfo );
		}
	}