Do you know of any way of testing sc_mail_send() macro. When I run it I get no errors and the mail seems to go out but when I check receiving emailbox nothing is coming.
receiver domain is Gmail and I’m using SMPT/POP3
Arthur,
This is the settings I use in my other apps:
Here is example of another method: PHP Script for Sending Email using Gmail SMTP
For sending email using SMTP we need not have entire PHPMailer library. It is sufficient to have only class.phpmailer.php and class.smtp.php of this library.
We should set subject, content and header information. When we send email using Gmail SMTP make sure to set SMTPAuth as TRUE and SMTPSecure as tls/ssl. Use your Gmail Username and Password to send email.
<?php require(‘phpmailer/class.phpmailer.php’);
$mail =newPHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug=0;
$mail->SMTPAuth= TRUE;
$mail->SMTPSecure=“tls”;
$mail->Port=587;
$mail->Username=“your gmail username”;
$mail->Password=“your gmail password”;
$mail->Host=“smtp.gmail.com”;
$mail->Mailer=“smtp”;
$mail->SetFrom(“Your from email”,“from name”);
$mail->AddReplyTo(“from email”,“PHPPot”);
$mail->AddAddress(“recipient email”);
$mail->Subject=“Test email using PHP mailer”;
$mail->WordWrap=80;
$content ="<b>This is a test email using PHP mailer class.</b>";
$mail->MsgHTML($content);
$mail->IsHTML(true);
if(!$mail->Send()) echo “Problem sending email.”;
else echo “email sent.”;?>
For setting FromEmail and FromName, we can either use SetFrom()function or use PHPMailer properties PHPMailer::From and PHPMailer::FromName. For example,
$mail->From=“from email address”;
$mail->FromName=“from name”; AddReplyTo(), AddAddress() functions will accept array of email addresses, and name is optional.
If we have HTML content as mail body, we need to set content body text/html by using,
$mail->IsHTML(true);
After setting all properties and mailer information with PHPMailer object, PHPMailer::send() function returns TRUE on successful mail transfer and FALSE on failure.
Dr.Tim - thank you for all details. At this moment though I do not use GMail SMTP. I only use Gmail address as a recipient (to verify if the mail came through). I use my provider mail server so the address is typical (i.e server1.mysever.com) so in this case I’m not sure if your comments will apply. But It is god do know that this method at leaqst returns some result to test.
So far I neither have much experience implementing external libraries in SC and the documentation is terrible so there is lots of downtime when learning those things.
Just to play with it. Where do I place the phpmailer.php file and where do I download it ?