We have set up PHPMailer on our GoDaddy hosted website. We are aware of the particular settings GoDaddy requires in order for the plugin to work so we used those.
$m = new PHPMailer;
$m->isSMTP();
$m->Host = 'relay-hosting.secureserver.net';
//$m->SMTPDebug = 2;
$m->Port = 25;
$m->SMTPAuth = false;
$m->SMTPSecure = false;
$m->CharSet = "UTF-8";
$m->From = 'ouremail#godaddydomain.fm';
$m->FromName = 'OUR COMPANY';
$m->AddAddress($userEmail);
This worked perfectly for months, but about a week ago we started getting:
Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
We haven't touched the code for months so it's not something we changed.
Has anyone run into this issue in the last couple weeks? Any ideas on how to solve it? I've been on customer support with GoDaddy for 45 minutes and that did not help at all.
Thanks
After spending 3 hours! in chat with customer service, the only thing that helped was them sending me a sample form that used PHPMailer to send an email. After reading the code I realized that they are using an old version of PHPMailer. If you use the latest version it just doesn't work.
The version that works is 5.1. Host needs to be set to 'localhost'.
Related
I have a simple CRUD webapp set up in Python/Flask, when one particular function is activated (approving a request) I'd like to send an email notification to the user, but for all I've tried I can't get the email to send through my code.
Here is my config file with all the relevant environment variables set (inside of a Config object):
MAIL_SERVER = 'smtp.gmail.com'
MAIL_PORT=465
MAIL_USE_SSL=True
MAIL_USERNAME = '**#gmail.com'
MAIL_PASSWORD = '**'
I have also tried calling app.config.update(those values) in my app/init.py file. Here is the current code to do so
mail = Mail()
def create_app(config_name):
app = Flask(__name__, instance_relative_config=True)
app.config.from_object(app_config[config_name])
app.config.from_pyfile('./config.py')
app.config.update(
MAIL_SERVER='smtp.gmail.com',
MAIL_PORT=465,
MAIL_USE_SSL=True,
MAIL_USE_TLS=False,
MAIL_USERNAME = '**#gmail.com',
MAIL_PASSWORD = '**')
mail.init_app(app)
And finally here is the code where I actually attempt to send the email:
msg = Message(html=html, sender='**#gmail.com', subject='Your Reservation for %s' % reservation.item.name, recipients=['**'])
mail.send(msg)
Additionally, it currently fails silently and I don't know how to even view what error is happening. Any help is much appreciated!
My suggestion in the comments was indeed the answer to the question.
Enabling "Less Secure Apps" in the Google Account settings was the necessary step to fix the hangup the OP was experiencing. This link from Google's support page walks you through how to enable this option.
I think, you should switch your sending protocol to TLS
this is sample from my project
MAIL_SERVER='smtp.gmail.com',
MAIL_PORT=587,
MAIL_USE_TLS=True,
MAIL_USERNAME = '**#gmail.com',
MAIL_PASSWORD = '**'
for me this works very well.
Now that Google is removing the less-secure app access feature due to security reasons, the best way to get around this is to use Sendgrid. They provide 100 free emails per day forever. You can register your same Gmail address as a single sender in SendGrid. Generate an API key and use it in your flask app to send emails.
For reference: Sending Emails from Python Flask Applications With Twilio SendGrid
Im in the process of constructing a Webmail SPA, similar to Gmail, for end users. This app will be hosted on a cPanel shared hosting (LAMP stack). The end users have no cpanel email access otherwise. My app will be their access portal for these email accounts.
If it matters, I'm preferably a node developer, with LAMP experience, so I'm open to any broad suggestions. Note, normally im just bouncing things out, using smtp. Would i just do this straight Imap? I just want to know on an architectural level what service i need to be accessing, or looking for and maybe a point in the direction of some example.
Maybe a wire-frame, a flowchart, or a sentence that can describe how I can implement it will suffice. I can find the technologies, I just need a road map.
This is a RHEL6
$ uname -a
Linux 2.6.32-604.30.3.lve1.3.63.el6.x86_64 #1 SMP Sun Sep 27 06:34:10 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux
Some questions based on the only way im able to think about this problem:
What protocol normally accesses the email (user?) Would i be getting something, maybe an internal mail command access from system environment variables, or PATH maybe? Would i ping for a user list, i mean what information does the app need to connect to the mail server, and what protocol would i get that from? I think this is my hitch.
I guess the first thing, is during post, it auths, what happens after auth, what protocol, where/what will i be looking to make that decision based on, and how do i pull in the email list after? Im guessing this is just an IMAP requst. Is that all i need? e.g. php mail() or nodemailer?
Also I cant seem to come up with the proper terminology to get any meaningful google search results, I'm open to search query help as an alternative, not sure what techs I'im looking for yet.
Edit:
On some research i have found the following;
Some search terms that are finally yielding a few results
webmail interfacing php (or node)
webmail single page application node (or php)
Looks like this might be one example of a way a node app connects to an imap
https://github.com/cozy-labs/emails/blob/master/server/imap/pool.coffee
I believe that mail util is here https://www.npmjs.com/package/nodeutil
If someone can help me put this into perspective, that would be great.
Some answers on this:
To roll your own, webmail on a shared host, cPanel API's, curl, fopen, and 3rd party email application apis would be the starting point.
cPanel may not fully support this however they do have apis, UAPI being the most likely for some basic scenarios. https://documentation.cpanel.net/display/SDK/UAPI+Functions+-+Email%3A%3Alist_pops
However, Afterligic's WebMail Lite contains a promising looking solution, with a PHP,REST, and JavaScript API. http://www.afterlogic.org/docs/webmail-lite/integration-and-development
The PHP example to read messages looks like it might be this one here
<?php
include_once __DIR__.'/../libraries/afterlogic/api.php';
if (class_exists('CApi') && CApi::IsValid())
{
// data for logging into account
$sEmail = 'user#domain.com';
$sPassword = 'PassWord';
$sFolder = 'INBOX';
$iOffset = 0;
$iLimit = 5;
$oCollection = null;
try
{
$oApiIntegratorManager = CApi::Manager('integrator');
$oAccount = $oApiIntegratorManager->LoginToAccount($sEmail, $sPassword);
if ($oAccount)
{
$oApiMailManager = CApi::Manager('mail');
$oCollection = $oApiMailManager->getMessageList($oAccount, $sFolder, $iOffset, $iLimit);
if ($oCollection)
{
echo '<b>'.$oAccount->Email.':</b><br />';
echo '<pre>';
echo 'Folder: '.$sFolder."\n";
echo 'Count: '.$oCollection->MessageCount."\n"; // $oCollection->MessageResultCount
echo 'Unread: '.$oCollection->MessageUnseenCount."\n";
echo 'List: '."\n";
$oCollection->ForeachList(function ($oMessage) {
$oFrom = $oMessage->From();
echo "\t".htmlentities($oMessage->Uid().') '.$oMessage->Subject().($oFrom ? ' ('.$oFrom->ToString().')' : ''))."\n";
});
echo '</pre>';
}
else
{
echo $oApiMailManager->GetLastErrorMessage();
}
}
else
{
echo $oApiIntegratorManager->GetLastErrorMessage();
}
}
catch (Exception $oException)
{
echo $oException->getMessage();
}
}
else
{
echo 'AfterLogic API isn\'t available';
}
And a
Some other thoughts on rolling your own:
Heres an article shedding light on how to view accounts, using php
How to create an Email Account in Cpanel via PHP?
And one to list
How to access list of email accounts with cPanel API?
A cpanel class was built to provide a way to create and forward, and probably serves as the best example, on a start to the solution. http://sajjadhossain.com/tag/cpanel-class/ resourced from here where lots of testing was done on this topic http://www.zubrag.com/scripts/cpanel-create-email-account.php
To forward emails, in case that's of some use to get them possibly to another temp account
https://www.a2hosting.com/kb/cpanel/cpanel-mail-features/forwarding-incoming-e-mail-messages-to-a-script-file
Then there is the option for squirrel mail or the other two mail apps supported by cpanel: possibly turn one of those into a portal. Here is a way to auth to squirrel mail for e.g. http://squirrelmail.org/plugins_category.php?category_id=6
I tried to connect and add an issue to Mantis Bug Tracker serwis, but no success. I am using .Net Framework 2.0(Compact FrameWork). My Bug Tracker Service have a few projects and i want to add issue to specific one including user, time and description. I tried this, but nothing happened
Mantis.IssueData issue = new Mantis.IssueData();
issue.id = "1";
issue.description ="Test issue";
issue.date_submitted = DateTime.Now;
issue.description = "Test description";
MantisConnect mantisConnect = new Mantis.MantisConnect();
mantisConnect.Beginmc_issue_add(Properties.Resources.MantisLogin, Properties.Resources.MantisPassword, issue,null,null);
Thank you in advance for help
I have an app needs to open a browser and link to the address that I want. My project is coded on windows 8.1. I have research on google but I couldn't find any solutions.
This code below is good when dev in Windows Phone:
Launcher.LaunchUriAsync(new Uri("link"));
But in tablet,it made my app hidden and didn't do anything else.
Please give me any solutions for this problem. Thanks
Please try below code. I have checked and its working fine.
LauncherOptions options = new LauncherOptions();
options.DisplayApplicationPicker = true;
options.TreatAsUntrusted = true;
var success = await Launcher.LaunchUriAsync(new Uri("Your Link"), options);
Here, if you remove options.DisplayApplicationPicker=true then it will open default browser. I added that line because it helps user to select different apps each time.
I have a requirement (flexible) to use oauth2. (existing architecture/code)
I have a need to do some text manipulation of subscriber's email headers.
Solutions I've tried.
I've tried to download the sample code for java and it correctly connects to gmail's imap servers. It however responds with oath_version=1 and is expecting a password. I've tried to massage the code to change the params as other api's like their Contacts api oauth2 without success.
Question:
(multipart)
Api is down:http://code.google.com/googleapps/domain/email_migration/developers_guide_java.html any reference online would be ideal (it has been down for at least half a week since last week Wed). If you wondered - yes I did post on their forums before asking here for the updated link.
Is there a way to: a) make oauth2 request and b) Any (minimal) code exaples I can look at would be great.
Thanks in advance for reading this post.
Here is a working, Ruby example of fetching email from Google using the OAuth2 protocol:
imap = Net::IMAP.new('imap.gmail.com', 993, usessl = true, certs = nil, verify = false)
imap.authenticate('XOAUTH2', 'example#gmail.com', 'oauth2_access_token_goes_here')
imap.select('INBOX')
imap.search(['ALL']).each do |message_id|
msg = imap.fetch(message_id,'RFC822')[0].attr['RFC822']
mail = Mail.read_from_string msg
puts mail.subject
puts mail.text_part.body.to_s
puts mail.html_part.body.to_s
end
Note: This example uses ruby mail gem and gmail_xoauth gem, so you will need those installed for this code sample to work. I am also using the omniauth and omniauth-google-oauth2 gems to handle logging the user in and using the access token.