/** * Display the form for the second step of the configuration wizard * which consists in sending an email, which maybe a problem under Windows */ function DisplayStep2(SetupPage $oP, $sFrom, $sTo) { //$sNextOperation = 'step3'; $oP->add("<h1>iTop configuration wizard</h1>\n"); $oP->add("<h2>Step 2: send an email</h2>\n"); $oP->add("<p>Sending an email to '{$sTo}'... (From: '{$sFrom}')</p>\n"); $oP->add("<form method=\"post\">\n"); $oEmail = new Email(); $oEmail->SetRecipientTO($sTo); $oEmail->SetRecipientFrom($sFrom); $oEmail->SetSubject("Test iTop"); $oEmail->SetBody("<p>Hello,</p><p>The email function is now working fine.</p><p>You may now be able to use the notification function.</p><p>iTop</p>"); $iRes = $oEmail->Send($aIssues, true); switch ($iRes) { case EMAIL_SEND_OK: $sTransport = MetaModel::GetConfig()->Get('email_transport'); if ($sTransport == 'LogFile') { $oP->ok("The email has been logged into the file " . APPROOT . "/log/mail.log."); } else { $oP->ok("The email has been sent, check your inbox for the incoming mail..."); } $oP->add("<button onClick=\"window.history.back();\"><< Back</button>\n"); break; case EMAIL_SEND_PENDING: $oP->ok("Email queued"); $oP->add("<button onClick=\"window.history.back();\"><< Back</button>\n"); break; case EMAIL_SEND_ERROR: foreach ($aIssues as $sError) { $oP->error($sError); } $oP->add("<button onClick=\"window.history.back();\"><< Back</button>\n"); break; } }
/** * Display the form for the second step of the configuration wizard * which consists in sending an email, which maybe a problem under Windows */ function DisplayStep2(SetupPage $oP, $sFrom, $sTo) { //$sNextOperation = 'step3'; $oP->add("<h1>iTop configuration wizard</h1>\n"); $oP->add("<h2>Step 2: send an email</h2>\n"); $oP->add("<p>Sending an email to '{$sTo}'... (From: '{$sFrom}')</p>\n"); $oP->add("<form method=\"post\">\n"); $oEmail = new Email(); $oEmail->SetRecipientTO($sTo); $oEmail->SetRecipientFrom($sFrom); $oEmail->SetSubject("Test iTop"); $oEmail->SetBody("<p>Hello,</p><p>The email function is now working fine.</p><p>You may now be able to use the notification function.</p><p>iTop</p>"); $iRes = $oEmail->Send($aIssues, true); switch ($iRes) { case EMAIL_SEND_OK: $oP->ok("The email has been sent, you may now check that the email will arrive..."); break; case EMAIL_SEND_PENDING: $oP->ok("Email queued"); $oP->add("<button onClick=\"window.history.back();\"><< Back</button>\n"); break; case EMAIL_SEND_ERROR: foreach ($aIssues as $sError) { $oP->error($sError); } $oP->add("<button onClick=\"window.history.back();\"><< Back</button>\n"); break; } }