Avoid writing the password of a Gmail account in my code - email

I want to use a Gmail email to work as an SMTP server.
I don't want to write the password for the email server in my code, is possible another alternative?
Besides, my customer doesn't want to tell me the password of his Gmail email.
So what should I do to use the Gmail email as a SMTP server in my case?

Related

If authentication is required to send SMTP messages, how do different mail servers send messages to each other?

To learn about email and SMTP, I wrote a basic SMTP client using sockets to push an email to my outlook account, following an example from a textbook.
I ran into a hiccup though, when the outlook mail server required me to authenticate before I could send the email. After researching the issue, I learned this is to prevent mass email spam and sender spoofing, which makes sense. I resolved this by authenticating using my outlook email and sending the email to myself.
My follow up questions that I'm having trouble finding an answer to are:
If a different mail server, such as google, needs to push an email to my outlook inbox, how does it authenticate? Does the google mail server have an account with outlook?
Is it not possible to just send mail between any two mail servers? Do the mail server admins need to white list other email servers first?
Found my answer here: How to send a mail directly to SMTP server without authentication?
Turns out, I was not connecting to an external SMTP server for outlook, but rather a server for users to perform actions with their outlook account specifically.

How can i create an email server that recieve mails without existing user accounts?

i have an email domain but i want to create an email server using that email domain but these server should be able to recieve emails and handle them without existing user accounts.
I mean, if someone send an email like "aaa#mydomain.com" or "bbb#mydomain.com" the server should be able to recieve those emails and handled them but those user accounts (aaa or bbb or other any "users") don't really exist in my email server.
I don't know if i have to program from zero an email server that should be able to do that (I use Java) or if there's email servers out there that can do what i want to do.
Thanks in advance.

How to rewrite outgoing email address to SMTP login name in postfix?

I host a mail server, where users log in via SMTP to send email.
The current config of postfix allows every authenticated user to send emails with any sender address.
My objective is to prevent users sending mail with an other FROM: address than the sender’s own SMTP login name.
For example: if you log in with the username bob, you’re only allowed to send emails with the sender address bob#example.com.
smtpd_sender_restrictions could be a solution, but this would reject clients, who entered any other address.
A more elegant way would be to automatically rewrite all from addresses to the username they logged in with. That's, what I'm trying to achieve.
Just like Gmail, if you use it as an SMTP service to send emails, the messages are sent with the address you logged in to Gmail.
Currently the SMTP authentication is done by dovecot:
smtpd_sasl_type = dovecot
The server itself is really simple, no fancy custom per-user based stuff or multi-domain setup, just users SMTPing in, and sending emails. :-)
I know that smtp_generic_maps and sender_canonical_maps exist, but I coudn't find the way to automatically rewrite the senders address.
By automatically I mean not one-by-one in a separate file.
Thank you for your help!

CACert add domain

I've registered at CACert to get a trusted certificate for my domain example.com, when I want to add the domain in the CACert control panel I have to select a email adress that is used for this domain:
The CACert FAQ states that there is currently no other way than getting an email at one of the specified email accounts. I currently don't have an email server running on my server to receive that email, but I tried to run one and it didn't work. Of course I could have read the documentations for the email server and try to get the server working, but is there a simpler way of receiving that email, because I just need that one email and it would be a realy big effort to run a full email server for this? Can I maybe redirect a email that is send at admin#example.com to my email adress at yahoo? With OS I'm flexible, I can use Windows or Linux, I just want to know the easiest way of receiving that adress.
Thanks in advance
No, there isn't another way of verfifying. But you easily setup an smtp server with postfix to receive the email

sendmail disabled

My host has Sendmail() disabled. I'm basically looking for a way to bypass this. I want visitors to be able to send me (gmail account) an email where they first fill in their e-mail address, so they become the sender. It's for support questions and remarks.
If there is no way to bypass this, is there and alternative, perhaps using mailchimp..?
You can always use an alternative public send mail servers available. You can use one of them. Here is one Public Send Mail server list
use phpmailer library. you can send email via connecting smtp (works with gmail too.) 1st configure one of your accounts with phpmailer. when the user fills in their email set the sender as user's email.
even though you are actually sending the email through your account to receiver of the email will show as sent by user's email address.
http://phpmailer.worxware.com/