gsuite mail with phpmailer - phpmailer

I set up my site registration form with phpmailer and gsuite. email is working perfectly. but I getting this notifications top of the register page after registration. what should I do for this?

It looks like you have enabled SMTP debugging. Check your configuration for the below.
$mail->SMTPDebug = SMTP::DEBUG_SERVER;
$mail->SMTPDebug = 2; //Alternative to above constant
PHPMailerSMTP Debugging

Related

how to send an email with flask-mail from a bussiness acount?

I`m trying to send mails with flask-mail, which I achieved since anaccount#gmail.com, but in production we need to send the mail from anaccount#myowndomain.mx which fails because from "#gmail.com" i can permit less secure apps, but in bussiness gmail acount I can´t...so my question is...
¿Is there another way to permite less secure apps? or ¿How coul I do my app more secure?, a workaround?
thanks in advance.
here´s my flask-mail configuration.
from flask_mail import Mail, Message
app.config['MAIL_SERVER']='smtp.gmail.com'
app.config['MAIL_PORT'] = 465
app.config['MAIL_USERNAME'] = '#myowndomain.mx'
app.config['MAIL_PASSWORD'] = '**********'
app.config['MAIL_USE_TLS'] = False
app.config['MAIL_USE_SSL'] = True
mail = Mail(app)
I solved the problem in base of this:
https://www.twilio.com/blog/2018/03/send-email-programmatically-with-gmail-python-and-flask.html
first you have to create a two step verification to your gmail account, then create an app password, and use this app pasword in the flask-mail configuration
Follow these steps
Enable "Less secure app" button in respective google account
Enable 2 step verification in respective account(complete the
steps which google prompts to setup 2 step verification)
Enable the App password which is present in security tab of
respective google account
Select the device and app option
copy paste the 16 digit app password your mail
configuration (e.g., MAIL_PASSWORD=16digit/character app password)

Google apps bounces emails sent from nodemailer, but gmail receives them fine

I've set up some google apps mailing groups, but emails from nodemailer to the groups are always getting 'bounced' (but no bounce-back email).
Individual gmail addresses receive the same nodemail fine. The admin email log looks like this for successful email to individual gmail user address. The email headers from the successful email show no issues (eg no spf failures).
The groups do receive emails from external users (including from the same address nodemailer uses) when sent through the gmail web client, so it it isn't a group permission issue. Successful emails to the group yields an admin log like this.
The group is set to forward all spam to users.
Nodemailer is using a gmail account, and the GApps are using a Google domain hosted address, so it shouldn't be an issue with routing or conflicting servers
What am I missing here?
This was resolved by reconfiguring the 'from' field in the nodemailer message.
// Nodemailer ignores the bad `from` value (not a valid email)
// Nodemailer sends with from ==''
// This gets bounced by google group addresses
var msg = {
from: "System",
to: "usergroupaddress#gmail.com,
subject: "Your generated email",
text: "Hello user",
html: "<p>Hello user</p>"
};
I had thought 'from' would define the name displayed on the email. It didn't do that, but it didn't cause any problems either for most email recipients. But google groups was bouncing those emails.
Nodemailer was just leaving 'from' as blank (rather than using my dummy string). Apparently this field must be a valid email address. Set it to an email address, and nodemailer will include it in the message envelope, which google groups will then stop bouncing.
// Nodemailer accepts and forwards the valid `from`
// google groups address will accept the email
var msg = {
from: "system#myserver.com",
to: "usergroupaddress#gmail.com,
subject: "Your generated email",
text: "Hello user",
html: "<p>Hello user</p>"
};
The google apps email also hints at this: emails with an empty 'from' envelope have a blank 'sender' in the google apps email log search. But as soon as I corrected nodemailer, the 'sender' started populating in email log search, and google stopped bouncing the emails. See the email log here.

Unable to send email from GoDaddy hosted php site

I have tried the solutions from the top 10 stack overflow questions and other resources found online before posting my question here;
I have a php site that's hosted on GoDaddy that's trying to send emails to an Office365 (same defect presents when sending to my gmail though). When originally developed 3 years ago, it would send emails no problem, sometime last year it stopped sending emails.
The original code that used to work
$admin_email = "email#domain.com";
$email = $_REQUEST['email'];
$message = $_REQUEST['message'];
$message = 'FROM: ' . $email . "\r\n" . $message;
mail($admin_email, "New Message", $message, "From:" . $admin_email);
I also tried using PHPMailer with all manner of options.
These two don't error but I never get the email.
$mail = new PHPMailer;
$mail->Host = "relay-hosting.secureserver.net";
$mail->Port = 25;
$mail->SMTPDebug = 0;
$mail->SMTPSecure = "none";
$mail->SMTPAuth = false;
$mail->Username = "";
$mail->Password = "";
$mail->SMTPDebug = 0;
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'localhost';
$mail->Port = 25;
$mail->ssl = false;
$mail->authentication = false;
And this one throws SMTP -> ERROR: Failed to connect to server
$mail = new PHPMailer;
$mail->SMTPDebug = 2;
$mail->IsSMTP();
$mail->Host = 'localhost';
$mail->SMTPAuth = false;
All are sent with
$mail->From = $from;
$mail->FromName = $admin_email;
$mail->AddAddress($email);
$mail->Subject = "New Message";
$mail->Body = $message;
$mail->IsHTML(true);
$mailresult = $mail->Send();
I have also made sure the domain has the following txt records
NETORGFT1413837.onmicrosoft.com
v=spf1 include:spf.protection.outlook.com -all
v=spf1 include:secureserver.net -all
Yes I checked junk/spam folders
The regular php mailer mail($to,$subject,$message,"From:email#address.com"); sends to gmail junk folder doesn't reach Office365 account
The regular php mailer mail($to,$subject,$message,"From:email#address.com"); sends to gmail junk folder doesn't reach Office365 account
I believe the reason this goes to your junk folder in Gmail is because emails sent via PHP's mail() function through GoDaddy are not authenticated. I also tried to utilize SPF records to resolve this, but it was unsuccessful.
Here's a workaround that you might be interested in if you have a Gmail account.
Requirements:
Gmail account, XAMPP or similar local web server, PHPMailer library
(tutorials on how to use XAMPP and PHPMailer are abundantly available online)
Instructions:
Go to "Settings" in your Gmail account. Under "Accounts and Import,"
add "youraccount#domainyouown.com" in the "Send Mail As" section.
In your PHP script (using the PHPMailer library), replace the credentials in the following lines of code with your Gmail credentials and the account you'd like to send from:
$mail->Username = 'username#gmail.com';
$mail->Password = 'yourpassword';
$mail->setFrom('youraccount#domainyouown.com', 'Your Name');
$mail->addReplyTo('youraccount#domainyouown.com', 'Your Name');
Added benefits of this method:
Emails are authenticated. I spent quite a while trying to achieve this via GoDaddy, to no avail. This removes the "possible spam" notification that is sometimes present with emails sent through hosting server relays...
Emails are sent faster. For whatever reason, the emails I sent via GoDaddy using PHP's mail() function took a few minutes to go through. Gmail takes seconds.
Copies of the emails you send actually show up in your Gmail "Sent" folder. This was also something that I could not achieve via GoDaddy, and I was told by customer support that this is a limitation of the service.

Anonymous register an account, will send mail to notify the person in charge

I have facing some difficulty on changing principal : as "Anonymous" in the email during sending an email.
My system is an online system that allow user to register their account, then Admin will just need to click the register button to register their staff in their organization.
For my understanding, Anonymous is a default account in domino system for "outsider" whoever accessing their server / website.
below is my sample coding:
var web = setdoc.getItemValueString("InternetAddress");
var maildoc:NotesDocument = database.createDocument()
maildoc.replaceItemValue("Form", "Memo");
maildoc.replaceItemValue("Subject","Request for Email Account By Applicant);
session.setConvertMime(false);
var stream = session.createStream();
stream.writeText("<html><body>");
stream.writeText("<p>Dear " + "department reviewer" + ",</p>");
stream.writeText('<p>Kindly review this request by '+document1.getItemValueString('Name')+" on "+I18n.toString(#Today(), 'dd/MM/yyyy')+ ",</p>");
stream.writeText("</body></html>");
var body = maildoc.createMIMEEntity("Body");
body.setContentFromText(stream, "text/html;charset=UTF-8", 1725);
stream.close();
maildoc.closeMIMEEntities(true);
session.setConvertMime(true);
maildoc.replaceItemValue("SendTo",document1.getItemValue("Dep_rev"));
maildoc.send();
Attached will be sample photo of my email:
Is there any way to change the Anonymous name to other name?
You are using the current session to send the mail. Therefore the sender is anonymous.
You have several options:
Use sessionAsSigner to get hold of the database and create your mail document from there. This should change the sender
Set the From and Principal fields to the name of the sender. You must include the Domino domain name at the end of the Principal field (sender#company.com#dominodomain)
Set the From and Principal fields and copy the mail directly to mail.box on the server.

Preserving Email Subject & Email Message from actual Template when sending via Custom Button in Salesforce

I would like to preserve the Email Subject & email Message that are defined on the Docusign Template and send those vs sending generic email subject & message when sending a document via Custom Button in Salesforce? Below is my button code
{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
var DST='<Docusign Template Id>';
var LA='0';
var OSO = 'Send';
var CRL = 'Email~{!Fulfillment__c.Primary_Contact_Email__c};Role~Client;FirstName~ {!Fulfillment__c.Primary_Contact_First_Name__c};LastName~{!Fulfillment__c.Primary_Contact_Last_Name__c}';
var CCRM='Client~Client';
window.location.href = '/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID='+eSignatureNotSent.Id+'&DST='+DST+'&LA='+LA+'&CRL='+CRL+'&OCO='+OCO+'&CCRM='+CCRM;
I think Docusign is using Default Email Subject and Default Email Message defined in the Admin settings in Salesforce. I do not want to send it as all the work is done when building templates in Docusign.
If you leave the Default Email Message blank in the Admin settings, it will grab the contents of the Template Email Message.
The API has a hard requirement to define an email subject through the request. Currently because Salesforce uses the API, it has to follow this guideline.
My best advice is making a custom button that defines the Email subject that you'd like for each workflow that you may have.

Resources