I want to read my Gmail inbox emails using c++ builder so I use this code I got it from videos on youtube, but before i read i tried to connect first using this code in the button.
MyPoP3
POP3->Host = "pop.gmail.com";
POP3->Port = 995;
POP3->Username = "#gmail.com";
POP3->Password = "my pass";
POP3->Connect();
Memo1->Text = "Number = " + IntToStr(MyPoP3->CheckMessages()) + "\n";
MyPoP3->Disconnect();
and i got this error message after a short delay.
error connection closed gracefully
this my first time iam use c++ builder I just learn it so please any help with that error because I can't find any good resource for it.
Thanks in advance.
The error message means the server is closing its end of the TCP connection.
POP3 port 995 uses SSL encryption, so in order to communicate with Gmail on port 995, you must:
assign an TIdSSLIOHandlerSocketBase-derived component to the TIdPOP3.IOHandler property, such as TIdSSLIOHandlerSocketOpenSSL (and deploy the 2 OpenSSL DLLs with your app).
set the TIdPOP3.UseTLS property to utUseImplicitTLS.
if you have 2-factor authentication enabled in your Gmail account, create an application-specific password for your app to use instead of your real Gmail password (as Indy does not yet implement support for OAuth authentication for POP3 and other protocols).
Related
I have Google cloud compute server instance. And i want to send email using smtp.gmail.com with port 465 using PHPMailer function. but it return error : "SMTP error: Could not authenticate."
I don't want to used any third party mail provider like Sendgrid, Mailgun, Mailjet and G Suite.
On other server like AWS we just have to enable email setting and port to send email. I don't want to integrate any 3rd party email provider.
I am new to google cloud server configuration. Please someone help me to send email using smtp.gmail.com with port 465 from google cloud compute engine.
Thanks in advance.
As documented here, you will have to use a SMTP relay agent service using a GSuite domain. This is only if you do not want use the third party email providers. Using the SMTP realy agent service, you can only use port 465 or 587.
I know your question was asked in February of 2019, but I came across it and wanted to give more information for those who may find your question.
PHP is great for sending email because it is fast. PHP mail settings are configured in your PHP.ini file and most issues with it can be resolved via some setting in there. Google cloud has ports 465 (ssl) and 587 (tls) open for you to use. In fact, only port 25 is closed. You specified you were using 465, so you are good to go there. The issue is that you are trying to use Google's SMTP system and likely have not set up the proper configuration - hence the system cannot authenticate you. PHP just creates the message and hands it off to the system to send. The system's smptp system requires a valid login to send mail though. Remember, PHP does NOT require authentication for you to use it.
You can use POST SMTP, which is a free wordpress plugin, to help you configure things if you are using Wordpress.
Walk through this document to see what settings you may need to configure.
https://cloud.google.com/compute/docs/tutorials/sending-mail/
You said you didn't want to use GSuite, but you should read through the documentation for the setup so you can see how to configure the SMTP settings. I am including the link to read the document because email on Google Compute Engine is not trivial and there are little things to configure here and there that you should know about.
https://www.jvfconsulting.com/blog/php-mail-function-vs-smtp-guaranteed-delivery/
I am using Ruby on Rails 4, I own my own webserver with domainname, but use a local maschine to send mails.
I send mails via SMTP (ActionMailer::Base.smtp_settings = {..settings..})
To my question: Is it possible to send mails with the message-id that is like ...#example.com (my domainname) and not like ...#localhostname.mail?
And if I cannot get it from SMTP (or how ever those message-ids are generated) could I just override the message-id-header so that abcd#localhostname.mail becomes abcd#example.com? Or does that mess something up? For example when I send a mail from my system and another from my normal mail program.
Thanks in advance
There are settings for your SMTP server software (postfix?) to set a domain name so it doesn't use your local hostname. You should go through the documentation of your SMTP software to find out which setting this is (sorry, I'm not a real email expert).
We have had issues with our server being used to send spam via cfmail to our remote SMTP server. I cannot see where it is occurring, but the emails are sent from a domain that is not one on our server.
Is there a way using ColdFusion administrator to specify that only emails showing as from someone#mydomain.com are sent to the SMTP host via the spool?
Thanks in advance,
Paul
It sounds to me like the <cfmail> side of things here is a red herring and you have got an open relay on your mail server. You seriously need to disable that immediately! If your SMTP server has to relay email for your CFML app then make sure it's not configured to relay everything, instead just for the IP address of the CF server, or for the credentials the CF server uses to connect to it.
If you don't know how to configure the relaying settings for your SMTP server, raise another question on serverfault.com asking how. Provide the exact details of your SMTP server, as well as the requirement to still allow relaying for the CF server.
I want to send email over SMTP using c++ code, how should I handle it in generic way that a random user don't have to handle SMTP server specification? (Windows)
Without specification means user should not have to write IP address of SMTP server etc.
Install an smtp relay server on the same host where the code runs and set the SMTP server in the code to 'localhost'.
Jasper's answer is correct. You need to install an SMTP server on the host that your C++ program is running on. One option is qmail. See www.lifewithqmail.org for more info, including a step-by-step guide on how to install it.
Most linux SMTP servers (including qmail) will create a smylink /usr/sbin/sendmail which you can use to send an outgoing message. In general, the syntax is:
/usr/sbin/sendmail recipient#domain.tld < /path/to/file/containing/the/message
See the help file for more info, including flags that you can use to specify the envelope sender, etc.
You can send a message from your C++ program by doing a system call to /usr/sbin/sendmail similar to the above.
You could use Simple MAPI, but you need an email program supporting the MAPI-interface like Outlook.
I would like to create a mail sender on C++ (not Mail Client for eg. GMail). In this mailer I want to be able to change the headers also.
I have already downloaded and installed the POCO libraries, that might help (I found it on a similar anwser).
For example, what I would like is a command like below:
e-mailsend(to,headers,subject,message);
// Or something like:
email.send(to,headers,subject,message);
However, If possible, I would like to use a C++ Mail function not a system function (like mail-utils in unix).
If you need any more explanation please comment...
In your comments you asked for an option without an SMTP server.
SMTP requires an SMTP Server. The choice is that could send emails directly (e.g. to joe at yahoo.com on port 25) or to a SMTP server that will relay the message.
Ideally, you will want your own SMTP server locally (so your application is simpler and your SMTP server sends the messages in the background, handles retries, bounces and connection errors) and use a reputable SMTP service or an existing email account.
If you want to send spam, I'd strongly advise against it.
If you want to send a small number of messages that will be opened by people expecting those messages, use a normal account (Yahoo, GMail, Google Apps, etc) and if you find your application not responsive enough, install Postfix, Sendmail or whatever local SMTP server you like.
If you want to send a large volume of emails and you are sure those message won't get you targeted as a spammer, use an SMTP service, like SendGrid (note: they also have a web API that you might find easier to use than SMTP).
Depending on which of the above you need, I'm sure answering your original question with a recommendation for SMTP C++ clients (like POCO) with become simpler.