I have been trying to send emails, with differents providers with no sucess… always get error, indeed I tried with the parameters posted by vitorjamil in “hot tips” forum and nothing… always gets an error response…
Can you send emails with SC?
I have been trying to send emails, with differents providers with no sucess… always get error, indeed I tried with the parameters posted by vitorjamil in “hot tips” forum and nothing… always gets an error response…
Can you send emails with SC?
Re: Can’t send emails with SC5
are you using a windows or linux server?
Re: Can’t send emails with SC5
Here is a function I setup for one of my apps. I tried to remove all the extra code, but leave the important parts:
function email_request_info($email_to) {
sc_lookup(tbl_smtp, 'SELECT * FROM rnr_smtp_settings LIMIT 0,1');
if ({tbl_smtp} == true) {
if (!empty({tbl_smtp})) {
$smtp_send = {tbl_smtp[0][1]};
$smtp_server = (!empty({tbl_smtp[0][2]}))?{tbl_smtp[0][2]}:'localhost';
$smtp_auth = (!empty({tbl_smtp[0][3]}))?"Y":"";
$smtp_user = (!empty({tbl_smtp[0][4]}))?{tbl_smtp[0][4]}:'';
$smtp_pass = (!empty({tbl_smtp[0][5]}))?{tbl_smtp[0][5]}:'';
$smtp_port = (!empty({tbl_smtp[0][6]}))?{tbl_smtp[0][6]}:'25';
$email_from = (!empty({tbl_smtp[0][7]}))?{tbl_smtp[0][7]}:'';
if ($email_to == '') { // grab default if not sent from function call
$email_from = (!empty({tbl_smtp[0][8]}))?{tbl_smtp[0][8]}:'';
}
if ($smtp_send != 1) { return; } // get out, no email per settings
$email_subject = {request_subject};
$email_body = {request_body};
sc_mail_send( $smtp_server,$smtp_user,$smtp_pass,$email_from,$email_to,$email_subject,$email_body,'H',"","",$smtp_port,$smtp_auth,"");
if ({sc_mail_ok} == false) {
sc_error_message({sc_mail_erro});
return false;
} else {
echo 'Request information has been emailed to '.$email_to;
return true;
}
} else { echo 'ERROR(1): Unable to determine SMTP Settings. Please contact Administrator to correct this problem'; }
} else { echo 'ERROR(2): Unable to determine SMTP Settings. Please contact Administrator to correct this problem'; }
}
Regards,
Scott.
Re: Can’t send emails with SC5
Also, where is the error that you are receiving?
Regards,
Scott.
Re: Can’t send emails with SC5
Right now I am developing using a Windows OS, but my hope is to install the system in any OS without any limitations, specially in Linux (I love Debian), thats why I avoid the use of functions that may create problems between OS
s, such as reading files, permissions, line breaks and many others.
Let me try inmediatly with your code Scott and I`ll post results
Re: Can’t send emails with SC5
Scott, can you give a copy of the rnr_smtp mysql Table?? that would clear many doubts about SMTP settings…
Re: Can’t send emails with SC5
CREATE TABLE IF NOT EXISTS `rnr_smtp_settings` (
`id_smtp` int(11) NOT NULL AUTO_INCREMENT,
`is_send_email` tinyint(4) NOT NULL,
`smtp_server` varchar(50) NOT NULL,
`smtp_auth_required` tinyint(4) NOT NULL,
`smtp_user_name` varchar(50) NOT NULL,
`smtp_password` varchar(20) NOT NULL,
`smtp_port` varchar(5) NOT NULL,
`email_origin` varchar(50) NOT NULL,
`email_destination` varchar(50) NOT NULL,
PRIMARY KEY (`id_smtp`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
INSERT INTO `rnr_smtp_settings` (`id_smtp`, `is_send_email`, `smtp_server`, `smtp_auth_required`, `smtp_user_name`, `smtp_password`, `smtp_port`, `email_origin`, `email_destination`) VALUES
(1, 1, 'mail.mydomain.com', 1, 'smtp_user@mydomain.com', 'smtp_password', '587', 'reply_email@mydomain.com', 'from_email@mydomain.com');
Re: Can’t send emails with SC5
Nothing, I can?t get it work. this is the error message I always receive
Uncaught Error of type [Swift_ConnectionException] with message [Authentication failed using username ‘lisandrogalup@gmail.com’ and password ‘********’]
@0 Email_Clientes_apl::controle() in C:wampwwwscriptcaseappClancelEmail_ClientesEmail_Clientes.php on line 1198
@1 Email_Clientes_apl::Valida_campos() in C:wampwwwscriptcaseappClancelEmail_ClientesEmail_Clientes_apl.php on line 760
@2 Email_Clientes_apl::email_request_info() in C:wampwwwscriptcaseappClancelEmail_ClientesEmail_Clientes_apl.php on line 1159
@3 Swift::Swift() in C:wampwwwscriptcaseappClancelEmail_ClientesEmail_Clientes_apl.php on line 1736
@4 Swift::connect() in C:wampwwwscriptcaseprod hirdemail_newlibSwift.php on line 109
Of course the password is ok, same for login, I try with login with ‘@gmail.com’ and without it… always shows same error.
Re: Can’t send emails with SC5
I will see if I can find some answers. Meanwhile, have a look at:
http://www.vishalkumar.in/2009/06/php-mail-using-gmail-smtp-tutorial/
http://glob.com.au/sendmail/
Point being … try and see if you can send email outside of SC5 using PHP(mail) or CLI (sendmail)
I am not sure what is available for Windows as I use Linux and all this is provide. (Make your move to Debian!) <bg>
Regards,
Scott.
Re: Can’t send emails with SC5
Most of the sc_ macros don’t work for me either. I usually get a “undefined function” error.
I worked around the email problem by falling back to PHP mail function with something like
$msg = {fullname}." requests more information to be emailed to “.{email}.”. Reason: ".{message};
$vmail = {email};
$sbj = "Info Request from Website- Index “.[parm1].”: ".[parm2];
$to = “admin@somedomain.com”;
$headers = “From: noreply@ourwebsite.com”;
if (mail($to, $sbj, $msg,$headers)) {
sc_alert(“Message successfully sent!”);
}
else
{
sc_alert(“Message delivery failed…”);
}
sc_exit(ok,ref);
This should work if SMTP and PHP is configured correctly on the server.
Re: Can’t send emails with SC5
i forget what it was, but i had a problem sending emails in SC before on a windows server. it was a PHP INI setting, it was on the PHP doc site and it was a windows glitch. I remember getting a very similar error that you’re getting.
Re: Can’t send emails with SC5
You may also want to have a look at PHPMailer:
http://phpmailer.worxware.com/
I simply copied the download to a directory under my app and called it with include(…) as shown in the examples.
They have plenty of examples and I have tested the SMTP example as working fine a SC5 Control app.
http://phpmailer.worxware.com/index.php?pg=examplebsmtp
Other examples.
http://phpmailer.worxware.com/index.php?pg=examples
Regards,
Scott.
Re: Can’t send emails with SC5
I have same problem,
I need to send email alert in the calendar application, then I create 3 fields in the calendar app,
email1 varchar 100 -to send as email alert 1
email2 varchar 100 -to send as email alert 2
alert int -as flag to send alert the title and description of the event if flag is 1 and 0 to don?t send alert.
Please tell me if there is a easy way to solve?
I need to send alert when the event comes to date and time exactly,
thanks
Eduardo Cazares
Re: Can’t send emails with SC5
Is your problem sending the email or sending it at the date/time of the event?
Re: Can’t send emails with SC5
The problem is sending the title and message of the date in the moment that occurs date and time, like an alarm in outlook or google docs.
Eduardo Cazares
Re: Can’t send emails with SC5
Scheduling tasks like this is no job php can handle, you have to use the OS for this purpose.
Schedule a cron job / scheduled task that runs every 5 minutes for example. So every 5 minutes your php script is executed. This php script should query on calendar events that have not been mailed yet (flag) and have a event datetime that’s in the past.
Google will help you on the exact syntax depending on your OS/webserver.
Re: Can’t send emails with SC5
Hi Scott,
You seem to have knowedge in this area and I wondered if you could assist.
I have successfully used sc_mail_send macro to send emails with the following account settings:
SMTP: smtp.mail.yahoo.com.br
user: arteiro.netmake
pwd: netmake2009
email from: arteiro.netmake@yahoo.com.br
port: 587
However I cannot get it to work with these settings
SMTP: smtp.gmail.com
user: georgeloseby
pwd: ********
email from: georgeloseby@gmail.com
port: 587
Here is the code I have used:
sc_mail_send ($smtp, $usr, $pw, $from , $to , $subject , $msg, ‘H’, ‘’, ‘’, $port, ‘’, $this->Ini->path_doc . ‘/’ . $attachment );
I get the follwing error:
Uncaught Error of type [Swift_ConnectionException] with message [Authentication failed using username ‘georgeloseby’ and password ‘*********’]
I use the exact same setting for my gmail in Outlook and it works. One thing I have noticed with the gmail account is that it requires TLS encryption could this be the reason why it is not working? How can we get this to work?
Many thanks.
George
Re: Can’t send emails with SC5
Several things?
in your send:
sc_mail_send ($smtp, $usr, $pw, $from , $to , $subject , $msg, ‘H’, ‘’, ‘’, $port, ‘’, $this->Ini->path_doc . ‘/’ . $attachment );
You do not specify smtp_auth, try:
sc_mail_send ($smtp, $usr, $pw, $from , $to , $subject , $msg, ‘H’, ‘’, ‘’, $port, ‘Y’, $this->Ini->path_doc . ‘/’ . $attachment );
You may als try port 465.
I suspect the first issue is the problem.
Regards,
Scott.