trying to send mail using swift mailer, gmail smtp, php
GMail’s SMTP requires encryption. Use: Swift_SmtpTransport::newInstance(‘smtp.gmail.com’, 465, “ssl”);
GMail’s SMTP requires encryption. Use: Swift_SmtpTransport::newInstance(‘smtp.gmail.com’, 465, “ssl”);
Following code snippet really works for me: $Username = “MyUserName”; $Password = “MyPassword”; $path = “C:\attachment.txt”; function Send-ToEmail([string]$email, [string]$attachmentpath){ $message = new-object Net.Mail.MailMessage; $message.From = “YourName@gmail.com”; $message.To.Add($email); $message.Subject = “subject text here…”; $message.Body = “body text here…”; $attachment = New-Object Net.Mail.Attachment($attachmentpath); $message.Attachments.Add($attachment); $smtp = new-object Net.Mail.SmtpClient(“smtp.gmail.com”, “587”); $smtp.EnableSSL = $true; $smtp.Credentials = New-Object System.Net.NetworkCredential($Username, $Password); … Read more
The same way, using msg.attach: from email.mime.text import MIMEText filename = “text.txt” f = file(filename) attachment = MIMEText(f.read()) attachment.add_header(‘Content-Disposition’, ‘attachment’, filename=filename) msg.attach(attachment)
By setting the values <mailSettings> section of the in the web.config you can just new up an SmtpClient and the client will use those settings. https://learn.microsoft.com/en-us/dotnet/api/system.net.mail.smtpclient.-ctor?view=net-6.0#system-net-mail-smtpclient-ctor Web.Config file: <configuration> <system.net> <mailSettings> <smtp from=”yourmail@gmail.com”> <network host=”smtp.gmail.com” port=”587″ userName=”yourmail@gmail.com” password=”yourpassword” enableSsl=”true”/> </smtp> </mailSettings> </system.net> </configuration> C#: SmtpClient smtpClient = new SmtpClient(); smtpClient.Send(msgMail); However, if authentication is needed, … Read more
Create a custom app in you Gmail security settings. Log-in into Gmail with your account Navigate to https://security.google.com/settings/security/apppasswords In ‘select app’ choose ‘custom’, give it an arbitrary name and press generate It will give you 16 chars token. Use the token as password in combination with your full Gmail account and two factor authentication will … Read more
The following works for microsoft, google, yahoo accounts on Python 2.7 and Python 3.2: #!/usr/bin/env python # -*- coding: utf-8 -*- “””Send email via smtp_host.””” import smtplib from email.mime.text import MIMEText from email.header import Header ####smtp_host=”smtp.live.com” # microsoft ####smtp_host=”smtp.gmail.com” # google smtp_host=”smtp.mail.yahoo.com” # yahoo login, password = … recipients_emails = [login] msg = MIMEText(‘body…’, ‘plain’, … Read more
As discussed previously, GoDaddy has been known to block outgoing SSL SMTP connections in favor of forcing you to use their own outgoing mail server. This is pretty much the tip of the iceberg, with regard to the immense suckitude of GoDaddy as a company, registrar and web host. Ditch’em.
Just Go here : Less secure apps , Log on using your Email and Password which use for sending mail in your c# code , and choose Turn On. Also please go to this link and click on Continue Allow access to your Google account also I edit it little bit : public string sendit(string … Read more
MailMessage msg = new MailMessage(); msg.Body = ….; msg.To.Add(…); msg.To.Add(…); SmtpClient smtp = new SmtpClient(); smtp.Send(msg); To is a MailAddressCollection, so you can add how many addresses you need. If you need a display name, try this: MailAddress to = new MailAddress( String.Format(“{0} <{1}>”,display_name, address));
Use SocksiPy: import smtplib import socks #’proxy_port’ should be an integer #’PROXY_TYPE_SOCKS4′ can be replaced to HTTP or PROXY_TYPE_SOCKS5 socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS4, proxy_host, proxy_port) socks.wrapmodule(smtplib) smtp = smtplib.SMTP() …