OUTLOOKDA ESKİ HOSTTA VE YENİ HOSSTA MAİL AÇILIR VE TAŞINMAMAK İSDENEN YERDEKİ KLASOR TAŞINACAK OLAN MAILE SÜRÜKLENİP BIRAKILIR.
Category: MAIL
php gmail yolla
Önce gmailinde bu özelliği aktif et https://accounts.google.com/DisplayUnlockCaptcha
daha sonra burdan php maileri indir https://github.com/PHPMailer/PHPMailer/ ve ftpne at
mail yollamak php kodları aşağıdadır
<?php
date_default_timezone_set('America/Toronto');
require 'PHPMailerAutoload.php';
require_once('class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$mail = new PHPMailer();
$body = "gdssdh";
//$body = eregi_replace("[\]",'',$body);
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "ssl://smtp.gmail.com"; // SMTP server
$mail->SMTPDebug = 1; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "tls"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 587; // set the SMTP port for the GMAIL server
$mail->Username = "sender@gmail.com"; // GMAIL username
$mail->Password = "senderpass"; // GMAIL password
$mail->SetFrom('receiver@gmail.com', 'PRSPS');
//$mail->AddReplyTo("receiver2@gmail.com', 'First Last");
$mail->Subject = "PRSPS password";
//$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$address = "receiver@gmail.com";
$mail->AddAddress($address, "user2");
//$mail->AddAttachment("images/phpmailer.gif"); // attachment
//$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
vbscript kullanarak gmail attachlı mail yolla
Aşağıdaki dosyayı önce gmail kullanıcı adını ve parolasını düzenle ve d:\ye sm.vbs olarak kaydet ve en altta cmd satırını uygula
‘ VBScript to Send Email Notification
‘ Author: https://helloacm.com
‘ Usage: cscript.exe sendemail.vbs email subject text
‘ 23/Dec/2014
Sub SendEmail(ToAddress, Subject, Text)
Dim iMsg
Dim iConf
Dim Flds
Set iMsg = CreateObject(“CDO.Message”)
Set iConf = CreateObject(“CDO.Configuration”)
iConf.Load -1
Set Flds = iConf.Fields
With Flds
.Item(“http://schemas.microsoft.com/cdo/configuration/smtpusessl”) = True
.Item(“http://schemas.microsoft.com/cdo/configuration/sendusername”) = “fromgmail@gmail.com”
.Item(“http://schemas.microsoft.com/cdo/configuration/sendpassword”) = “frompassword123”
.Item(“http://schemas.microsoft.com/cdo/configuration/smtpserver”) = “smtp.gmail.com” ‘smtp mail server
.Item(“http://schemas.microsoft.com/cdo/configuration/smtpserverport”) = 465 ‘stmp server
.Update
End With
With iMsg
Set .Configuration = iConf
.To = ToAddress
.From = “fromgmail@gmail.com”
.Subject = Subject
.TextBody = Text
.AddAttachment “C:\backup.txt”
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
End Sub
If WScript.Arguments.Count 3 Then
WScript.Echo “Usage: cscript.exe ” & WScript.ScriptFullName & ” email subject text”
Else
SendEmail WScript.Arguments(0), WScript.Arguments(1), WScript.Arguments(2)
End If
—————————–
komut satırında çalıştır aşağıdakini ve mail gider
cscript d:\sm.vbs togmail@gmail.com epostakonu epostaicerik
Send GMail from Delphi Easily
1-first login to : https://www.google.com/settings/security/lesssecureapps and turn on access for secure apps
2-Create on form : button, IdSSLIOHandlerSocketOpenSSL1, IdMessage1, IdSMTP1
3-Code
uses
idglobal;
procedure SendEmail(const Recipients: string; const Subject: string; const Body: string);
var
SMTP: TIdSMTP;
Email: TIdMessage;
SSLHandler: TIdSSLIOHandlerSocketOpenSSL;
eFrom: string;
begin
eFrom := 'from@gmail.com';
SMTP := TIdSMTP.Create(nil);
Email := TIdMessage.Create(nil);
SSLHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
try
SSLHandler.MaxLineAction := maException;
SSLHandler.SSLOptions.Method := sslvTLSv1;
SSLHandler.SSLOptions.Mode := sslmUnassigned;
SSLHandler.SSLOptions.VerifyMode := [];
SSLHandler.SSLOptions.VerifyDepth := 0;
SSLHandler.Host := 'smtp.gmail.com';
SSLHandler.Port := 587;
SMTP.IOHandler := SSLHandler;
SMTP.Host := 'smtp.gmail.com';
SMTP.Port := 587;
SMTP.Username := eFrom;
SMTP.Password := 'xxxxxx';
SMTP.UseTLS := utUseExplicitTLS;
Email.From.Address := eFrom;
Email.Recipients.EmailAddresses := Recipients;
Email.Subject := Subject;
Email.Body.Text := Body;
SMTP.Connect; //always raise 'Host not found'
SMTP.Send(Email);
SMTP.Disconnect;
finally
SMTP.Free;
Email.Free;
SSLHandler.Free;
end;
end;
;------------------------------------------------------------------------
procedure TestSendMail(Sender: TObject);
begin
SendEmail('to@yahoo.com', 'Subject', 'Body');
end;
